This package is to manage the taxation fee for the countries and product in the site. You can manage taxatopm fees easily by calling some easy function, (*1)
Install the package by add the following line in composer.json of your root directory, (*2)
"require": { ... ... "agriya/webshoptaxation": "dev", (*3)
},, (*4)
And then run "composer update", (*5)
2, After the package loaded add this line to app/conifg/app.php in the 'providers' array as like follows, (*6)
'providers' => array( ... ... 'Agriya\Webshoptaxation\WebshoptaxationServiceProvider', }
After that run the following migrations commands from your root directory to create the tables in ur database. This will create you two tables, (*7)
For published package php artisan migrate --package=Agriya/Webshoptaxation, (*8)
For workbench package php artisan migrate --bench=Agriya/Webshoptaxation, (*9)
Note: run these commands needs to be run from your root directory (where the composer.json has placed), (*10)
Thats it of installation. :), (*11)
Webshoptaxation::Taxations()->getTaxations([array $array, string $return_type]);, (*12)
$array(required) Array can have either 'id' or 'user_id' as element. If 'id' is passed, then the specific taxatiion detail will be returned. If 'user_id' is passed, then all taxatiion details of the specified user will be returned., (*13)
$return(optional) This can be either 'list' or 'all'. (default is 'list'), (*14)
'list' This will return the result as "id" and "tax name" combination 'firs' This will return first result with all fields from taxations table 'all' This will return all the fields from taxations table for the given condition
Webshoptaxation::Taxations()->getTaxations(array('user_id'=>1), 'all'); This will return all taxations details of the user id 1 from taxations table Webshoptaxation::Taxations()->getTaxations(array('user_id'=>1), 'list'); This will return the list ('id' => 'tax_name') combination for all taxations details for the user id 1 from taxations table Webshoptaxation::Taxations()->getTaxations(array('id'=>10), 'first'); This will return single taxations details for the id 10 from taxations table
$inputs = array( 'user_id' => 1, 'tax_name' => 'VAT', 'tax_description' => 'Value added tax', 'tax_fee' => '14.5', 'fee_type' => 'percentage', ); $taxatonid = Webshoptaxation::Taxations()->addTaxation($inputs);
$inputs = array( 'tax_name' => 'VAT', 'tax_description' => 'Value Added Tax', 'tax_fee' => '10', 'fee_type' => 'flat', ); $taxatonid = Webshoptaxation::Taxations()->updateTaxation(1, $inputs);
$taxatonid = Webshoptaxation::Taxations()->deleteTaxation(1);
$inputs = array( 'product_id' => $product_id, ); $producttaxatonslist = Webshoptaxation::ProductTaxations()->getProductTaxations($inputs);
$inputs = array( 'taxation_id' => 2, 'product_id' => 1, 'tax_fee' => '14.5', 'fee_type' => 'percentage', ); $producttaxatonid = Webshoptaxation::ProductTaxations()->addProductTaxation($inputs);
Update based on id ------------------- $inputs = array( 'tax_fee' => '5', 'fee_type' => 'flat', ); $taxatonid = Webshoptaxation::ProductTaxations()->updateProductTaxation(1, $inputs); Update based on conditions -------------------------- $inputs = array( 'tax_fee' => '5', 'fee_type' => 'flat', ); $conditions = array( 'product_id' => 1, 'taxation_id' => 2 ); $taxatonid = Webshoptaxation::ProductTaxations()->updateProductTaxation(null, $inputs, $conditions);
Delete based on id ------------------- $inputs = array( 'tax_fee' => '5', 'fee_type' => 'flat', ); $taxatonid = Webshoptaxation::ProductTaxations()->deleteProductTaxation(1); Delete based on conditions -------------------------- $inputs = array( 'tax_fee' => '5', 'fee_type' => 'flat', ); $conditions = array( 'product_id' => 1, 'taxation_id' => 2 ); $taxatonid = Webshoptaxation::ProductTaxations()->deleteProductTaxation(null, $conditions);