1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Services/SubscriptionService.php
2017-11-29 12:44:28 +02: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);
}
}