2016-12-08 14:41:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace $NAMESPACE$;
|
|
|
|
|
|
|
|
use Utils;
|
|
|
|
use URL;
|
|
|
|
use Auth;
|
|
|
|
use App\Ninja\Datatables\EntityDatatable;
|
|
|
|
|
|
|
|
class $CLASS$Datatable extends EntityDatatable
|
|
|
|
{
|
|
|
|
public $entityType = '$LOWER_NAME$';
|
|
|
|
public $sortCol = 1;
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
{
|
|
|
|
return [
|
2016-12-08 23:18:10 +01:00
|
|
|
$DATATABLE_COLUMNS$
|
2016-12-08 14:41:35 +01:00
|
|
|
[
|
|
|
|
'created_at',
|
|
|
|
function ($model) {
|
|
|
|
return Utils::timestampToDateString(strtotime($model->created_at));
|
|
|
|
}
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actions()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
2016-12-09 12:17:04 +01:00
|
|
|
mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'),
|
2016-12-08 14:41:35 +01:00
|
|
|
function ($model) {
|
|
|
|
return URL::to("$LOWER_NAME$/{$model->public_id}/edit");
|
|
|
|
},
|
|
|
|
function ($model) {
|
|
|
|
return Auth::user()->can('editByOwner', ['$LOWER_NAME$', $model->user_id]);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|