| @@ 80-106 (lines=27) @@ | ||
| 77 | * |
|
| 78 | * @return Grid |
|
| 79 | */ |
|
| 80 | protected function grid() |
|
| 81 | { |
|
| 82 | $grid = new Grid(new Role()); |
|
| 83 | ||
| 84 | $grid->id('ID')->sortable(); |
|
| 85 | $grid->slug(trans('admin.slug')); |
|
| 86 | $grid->name(trans('admin.name')); |
|
| 87 | ||
| 88 | $grid->permissions(trans('admin.permission'))->pluck('name')->label(); |
|
| 89 | ||
| 90 | $grid->created_at(trans('admin.created_at')); |
|
| 91 | $grid->updated_at(trans('admin.updated_at')); |
|
| 92 | ||
| 93 | $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
| 94 | if ($actions->row->slug == 'administrator') { |
|
| 95 | $actions->disableDelete(); |
|
| 96 | } |
|
| 97 | }); |
|
| 98 | ||
| 99 | $grid->tools(function (Grid\Tools $tools) { |
|
| 100 | $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
| 101 | $actions->disableDelete(); |
|
| 102 | }); |
|
| 103 | }); |
|
| 104 | ||
| 105 | return $grid; |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * Make a show builder. |
|
| @@ 79-103 (lines=25) @@ | ||
| 76 | * |
|
| 77 | * @return Grid |
|
| 78 | */ |
|
| 79 | protected function grid() |
|
| 80 | { |
|
| 81 | $grid = new Grid(new Administrator()); |
|
| 82 | ||
| 83 | $grid->id('ID')->sortable(); |
|
| 84 | $grid->username(trans('admin.username')); |
|
| 85 | $grid->name(trans('admin.name')); |
|
| 86 | $grid->roles(trans('admin.roles'))->pluck('name')->label(); |
|
| 87 | $grid->created_at(trans('admin.created_at')); |
|
| 88 | $grid->updated_at(trans('admin.updated_at')); |
|
| 89 | ||
| 90 | $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
| 91 | if ($actions->getKey() == 1) { |
|
| 92 | $actions->disableDelete(); |
|
| 93 | } |
|
| 94 | }); |
|
| 95 | ||
| 96 | $grid->tools(function (Grid\Tools $tools) { |
|
| 97 | $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
| 98 | $actions->disableDelete(); |
|
| 99 | }); |
|
| 100 | }); |
|
| 101 | ||
| 102 | return $grid; |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Make a show builder. |
|