invoiceninja/app/Console/Commands/stubs/datatable.stub

44 lines
952 B
Text
Raw Permalink Normal View History

2016-12-08 15:41:35 +02: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-09 00:18:10 +02:00
$DATATABLE_COLUMNS$
2016-12-08 15:41:35 +02:00
[
'created_at',
function ($model) {
2016-12-09 13:38:11 +02:00
return Utils::fromSqlDateTime($model->created_at);
2016-12-08 15:41:35 +02:00
}
],
];
}
public function actions()
{
return [
[
2016-12-09 13:17:04 +02:00
mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'),
2016-12-08 15:41:35 +02:00
function ($model) {
return URL::to("$LOWER_NAME$/{$model->public_id}/edit");
},
function ($model) {
return Auth::user()->can('editByOwner', ['$LOWER_NAME$', $model->user_id]);
}
],
];
}
}