1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
invoiceninja/app/Services/TokenService.php
2017-01-30 21:40:43 +02: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);
}
}