1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-18 23:42:25 +02:00
invoiceninja/app/Services/TaxRateService.php
2019-01-30 22:25:37 +11:00

56 lines
1.2 KiB
PHP

<?php
namespace App\Services;
use App\Ninja\Datatables\TaxRateDatatable;
use App\Ninja\Repositories\TaxRateRepository;
/**
* Class TaxRateService.
*/
class TaxRateService extends BaseService
{
/**
* @var TaxRateRepository
*/
protected $taxRateRepo;
/**
* @var DatatableService
*/
protected $datatableService;
/**
* TaxRateService constructor.
*
* @param TaxRateRepository $taxRateRepo
* @param DatatableService $datatableService
*/
public function __construct(TaxRateRepository $taxRateRepo, DatatableService $datatableService)
{
$this->taxRateRepo = $taxRateRepo;
$this->datatableService = $datatableService;
}
/**
* @return TaxRateRepository
*/
protected function getRepo()
{
return $this->taxRateRepo;
}
/**
* @param $accountId
*
* @return \Illuminate\Http\JsonResponse
*/
public function getDatatable($accountId)
{
$datatable = new TaxRateDatatable(false);
$query = $this->taxRateRepo->find($accountId);
return $this->datatableService->createDatatable($datatable, $query);
}
}