1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Services/TokenService.php

67 lines
1.5 KiB
PHP
Raw Normal View History

2015-11-05 23:37:04 +01:00
<?php namespace App\Services;
use URL;
use App\Services\BaseService;
use App\Ninja\Repositories\TokenRepository;
class TokenService extends BaseService
{
protected $tokenRepo;
protected $datatableService;
public function __construct(TokenRepository $tokenRepo, DatatableService $datatableService)
{
$this->tokenRepo = $tokenRepo;
$this->datatableService = $datatableService;
}
protected function getRepo()
{
return $this->tokenRepo;
}
/*
public function save()
{
return null;
}
*/
2016-05-08 20:50:35 +02:00
public function getDatatable($userId)
2015-11-05 23:37:04 +01:00
{
2016-05-08 20:50:35 +02:00
$query = $this->tokenRepo->find($userId);
2015-11-05 23:37:04 +01:00
return $this->createDatatable(ENTITY_TOKEN, $query, false);
}
protected function getDatatableColumns($entityType, $hideClient)
{
return [
[
'name',
function ($model) {
2016-03-02 14:36:42 +01:00
return link_to("tokens/{$model->public_id}/edit", $model->name)->toHtml();
2015-11-05 23:37:04 +01:00
}
],
[
'token',
function ($model) {
return $model->token;
}
]
];
}
protected function getDatatableActions($entityType)
{
return [
[
uctrans('texts.edit_token'),
function ($model) {
return URL::to("tokens/{$model->public_id}/edit");
}
]
];
}
}