Skip to content
Richard McDaniel edited this page Feb 6, 2018 · 2 revisions

This page describes the models used in this library.

Model Description
GovernmentalUnitArea Examples of governmental unit areas are the USA, Alabama or Huntsville. Each one has a name and a PostGIS geometry that can be used to determine if a latitude and longitude falls within that jurisdiction.
TaxArea A tax area is an association between a governmental unit area and a particular tax. Each one has a name, a tax class name and an association with a GovernmentalUnitArea
BaseTaxInformationModel
TaxInformation

Example:

$id = DB::table($this->governmental_unit_areas)->insertGetId([
    'name' => 'Bessemer, AL',
    'area' => `...huge binary blob here...`
]);  

DB::table($this->tax_areas)->insert([
    'name' => 'Bessemer Occupational Tax',
    'tax' => BessemerOccupational::class,
    'governmental_unit_area_id' => $id,
]);

$results = $this->taxes->calculate(function ($taxes) {
    $taxes->setWorkLocation($this->getLocation('us.alabama.bessemer'));
    $taxes->setUser($this->user);
    $taxes->setEarnings(2300);
});

$this->assertSame(23.00, $results->getTax(BessemerOccupational::class));
Clone this wiki locally