1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00
invoiceninja/app/Services/TokenService.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

53 lines
1.1 KiB
PHP

<?php namespace App\Services;
use App\Ninja\Repositories\TokenRepository;
use App\Ninja\Datatables\TokenDatatable;
/**
* 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);
}
}