1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
invoiceninja/app/Services/TokenService.php
2015-11-06 00:37:04 +02:00

67 lines
1.5 KiB
PHP

<?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;
}
*/
public function getDatatable($accountId)
{
$query = $this->tokenRepo->find($accountId);
return $this->createDatatable(ENTITY_TOKEN, $query, false);
}
protected function getDatatableColumns($entityType, $hideClient)
{
return [
[
'name',
function ($model) {
return link_to("tokens/{$model->public_id}/edit", $model->name);
}
],
[
'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");
}
]
];
}
}