1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00
invoiceninja/app/Services/TaxRateService.php
2015-11-06 00:37:04 +02:00

68 lines
1.5 KiB
PHP

<?php namespace App\Services;
use URL;
use Auth;
use App\Services\BaseService;
use App\Ninja\Repositories\TaxRateRepository;
class TaxRateService extends BaseService
{
protected $taxRateRepo;
protected $datatableService;
public function __construct(TaxRateRepository $taxRateRepo, DatatableService $datatableService)
{
$this->taxRateRepo = $taxRateRepo;
$this->datatableService = $datatableService;
}
protected function getRepo()
{
return $this->taxRateRepo;
}
/*
public function save()
{
return null;
}
*/
public function getDatatable($accountId)
{
$query = $this->taxRateRepo->find($accountId);
return $this->createDatatable(ENTITY_TAX_RATE, $query, false);
}
protected function getDatatableColumns($entityType, $hideClient)
{
return [
[
'name',
function ($model) {
return link_to("tax_rates/{$model->public_id}/edit", $model->name);
}
],
[
'rate',
function ($model) {
return $model->rate . '%';
}
]
];
}
protected function getDatatableActions($entityType)
{
return [
[
uctrans('texts.edit_tax_rate'),
function ($model) {
return URL::to("tax_rates/{$model->public_id}/edit");
}
]
];
}
}