1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Services/ProductService.php
Holger Lösken 0fbda85a59 Code Refactoring
- Removed unused uses
- Type hinting for method parameters
- Removed commented code
- Introduced comments for classes and methods
- Short array syntax
2016-07-03 16:19:22 +00:00

50 lines
1.1 KiB
PHP

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