2018-01-30 20:58:55 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Ninja\Datatables;
|
|
|
|
|
|
|
|
|
|
use Auth;
|
|
|
|
|
use URL;
|
|
|
|
|
use Utils;
|
|
|
|
|
|
|
|
|
|
class ProposalCategoryDatatable extends EntityDatatable
|
|
|
|
|
{
|
|
|
|
|
public $entityType = ENTITY_PROPOSAL_CATEGORY;
|
|
|
|
|
public $sortCol = 1;
|
|
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
[
|
|
|
|
|
'name',
|
|
|
|
|
function ($model) {
|
2018-06-07 20:08:34 +10:00
|
|
|
if (Auth::user()->can('view', [ENTITY_PROPOSAL_CATEGORY, $model]) )
|
|
|
|
|
return link_to("proposals/categories/{$model->public_id}/edit", $model->name)->toHtml();
|
|
|
|
|
else
|
2018-02-04 18:47:55 +02:00
|
|
|
return $model->name;
|
|
|
|
|
|
2018-01-30 20:58:55 +02:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function actions()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
[
|
|
|
|
|
trans('texts.edit_category'),
|
|
|
|
|
function ($model) {
|
2018-01-31 16:33:33 +02:00
|
|
|
return URL::to("proposals/categories/{$model->public_id}/edit");
|
2018-01-30 20:58:55 +02:00
|
|
|
},
|
|
|
|
|
function ($model) {
|
2018-06-07 20:08:34 +10:00
|
|
|
return Auth::user()->can('view', [ENTITY_PROPOSAL_CATEGORY, $model]);
|
2018-01-30 20:58:55 +02:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|