Total Complexity | 3 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class HrAdvisorCrudController extends CrudController |
||
9 | { |
||
10 | use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation; |
||
11 | use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation; |
||
12 | |||
13 | /** |
||
14 | * Prepare the admin interface by setting the associated |
||
15 | * model, setting the route, and adding custom columns/fields. |
||
16 | * |
||
17 | * @return void |
||
18 | */ |
||
19 | public function setup() : void |
||
20 | { |
||
21 | $this->crud->setModel('App\Models\HrAdvisor'); |
||
22 | $this->crud->setRoute('admin/hr'); |
||
23 | $this->crud->setEntityNameStrings('HR advisor', 'HR advisors'); |
||
24 | } |
||
25 | |||
26 | public function setupListOperation() |
||
27 | { |
||
28 | $this->crud->addColumn([ |
||
29 | 'name' => 'id', |
||
30 | 'type' => 'number', |
||
31 | 'label' => 'ID' |
||
32 | ]); |
||
33 | $this->crud->addColumn([ |
||
34 | 'name' => 'user.full_name', |
||
35 | 'key' => 'full_name', |
||
36 | 'type' => 'text', |
||
37 | 'label' => 'Name' |
||
38 | ]); |
||
39 | $this->crud->addColumn([ |
||
40 | 'name' => 'department.name', |
||
41 | 'type' => 'text', |
||
42 | 'label' => 'Department', |
||
43 | 'limit' => 70 |
||
44 | ]); |
||
45 | } |
||
46 | |||
47 | public function setupUpdateOperation() |
||
64 | ]); |
||
65 | } |
||
66 | } |
||
67 |