| @@ 24-52 (lines=29) @@ | ||
| 21 | * |
|
| 22 | * @return Grid |
|
| 23 | */ |
|
| 24 | protected function grid() |
|
| 25 | { |
|
| 26 | $roleModel = config('admin.database.roles_model'); |
|
| 27 | ||
| 28 | $grid = new Grid(new $roleModel()); |
|
| 29 | ||
| 30 | $grid->column('id', 'ID')->sortable(); |
|
| 31 | $grid->column('slug', trans('admin.slug')); |
|
| 32 | $grid->column('name', trans('admin.name')); |
|
| 33 | ||
| 34 | $grid->column('permissions', trans('admin.permission'))->pluck('name')->label(); |
|
| 35 | ||
| 36 | $grid->column('created_at', trans('admin.created_at')); |
|
| 37 | $grid->column('updated_at', trans('admin.updated_at')); |
|
| 38 | ||
| 39 | $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
| 40 | if ($actions->row->slug == 'administrator') { |
|
| 41 | $actions->disableDelete(); |
|
| 42 | } |
|
| 43 | }); |
|
| 44 | ||
| 45 | $grid->tools(function (Grid\Tools $tools) { |
|
| 46 | $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
| 47 | $actions->disableDelete(); |
|
| 48 | }); |
|
| 49 | }); |
|
| 50 | ||
| 51 | return $grid; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Make a show builder. |
|
| @@ 24-50 (lines=27) @@ | ||
| 21 | * |
|
| 22 | * @return Grid |
|
| 23 | */ |
|
| 24 | protected function grid() |
|
| 25 | { |
|
| 26 | $userModel = config('admin.database.users_model'); |
|
| 27 | ||
| 28 | $grid = new Grid(new $userModel()); |
|
| 29 | ||
| 30 | $grid->column('id', 'ID')->sortable(); |
|
| 31 | $grid->column('username', trans('admin.username')); |
|
| 32 | $grid->column('name', trans('admin.name')); |
|
| 33 | $grid->column('roles', trans('admin.roles'))->pluck('name')->label(); |
|
| 34 | $grid->column('created_at', trans('admin.created_at')); |
|
| 35 | $grid->column('updated_at', trans('admin.updated_at')); |
|
| 36 | ||
| 37 | $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
| 38 | if ($actions->getKey() == 1) { |
|
| 39 | $actions->disableDelete(); |
|
| 40 | } |
|
| 41 | }); |
|
| 42 | ||
| 43 | $grid->tools(function (Grid\Tools $tools) { |
|
| 44 | $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
| 45 | $actions->disableDelete(); |
|
| 46 | }); |
|
| 47 | }); |
|
| 48 | ||
| 49 | return $grid; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Make a show builder. |
|