1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/app/Services/TokenService.php
2019-01-30 22:25:07 +11:00

56 lines
1.1 KiB
PHP

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