1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Console/Commands/stubs/datatable.stub
Hillel Coren 07f76067e0 CRUD
2016-12-09 00:18:10 +02:00

44 lines
958 B
Plaintext

<?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 [
$DATATABLE_COLUMNS$
[
'created_at',
function ($model) {
return Utils::timestampToDateString(strtotime($model->created_at));
}
],
];
}
public function actions()
{
return [
[
trans('texts.edit_$LOWER_NAME$'),
function ($model) {
return URL::to("$LOWER_NAME$/{$model->public_id}/edit");
},
function ($model) {
return Auth::user()->can('editByOwner', ['$LOWER_NAME$', $model->user_id]);
}
],
];
}
}