1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Services/TokenService.php

56 lines
1.1 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Services;
2015-11-05 23:37:04 +01:00
2016-05-23 18:52:20 +02:00
use App\Ninja\Datatables\TokenDatatable;
2017-01-30 20:40:43 +01:00
use App\Ninja\Repositories\TokenRepository;
2015-11-05 23:37:04 +01:00
/**
2017-01-30 20:40:43 +01:00
* Class TokenService.
*/
2015-11-05 23:37:04 +01:00
class TokenService extends BaseService
{
/**
* @var TokenRepository
*/
2015-11-05 23:37:04 +01:00
protected $tokenRepo;
/**
* @var DatatableService
*/
2015-11-05 23:37:04 +01:00
protected $datatableService;
/**
* TokenService constructor.
*
2017-01-30 20:40:43 +01:00
* @param TokenRepository $tokenRepo
* @param DatatableService $datatableService
*/
2015-11-05 23:37:04 +01:00
public function __construct(TokenRepository $tokenRepo, DatatableService $datatableService)
{
$this->tokenRepo = $tokenRepo;
$this->datatableService = $datatableService;
}
/**
* @return TokenRepository
*/
2015-11-05 23:37:04 +01:00
protected function getRepo()
{
return $this->tokenRepo;
}
/**
* @param $userId
2017-01-30 20:40:43 +01:00
*
* @return \Illuminate\Http\JsonResponse
*/
2016-05-08 20:50:35 +02:00
public function getDatatable($userId)
2015-11-05 23:37:04 +01:00
{
2016-05-23 18:52:20 +02:00
$datatable = new TokenDatatable(false);
2016-05-08 20:50:35 +02:00
$query = $this->tokenRepo->find($userId);
2015-11-05 23:37:04 +01:00
2016-05-23 18:52:20 +02:00
return $this->datatableService->createDatatable($datatable, $query);
2015-11-05 23:37:04 +01:00
}
2016-05-23 18:52:20 +02:00
}