1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00
invoiceninja/app/Services/SubscriptionService.php
2019-01-30 22:25:37 +11:00

56 lines
1.2 KiB
PHP

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