Passed
Push — task/manager-applicant-review-... ( a1a27a...d21381 )
by Xander
15:21 queued 09:20
created

ManagerCrudController::setup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 22
ccs 0
cts 12
cp 0
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Http\Controllers\Admin;
4
5
use Backpack\CRUD\app\Http\Controllers\CrudController;
6
7
class ManagerCrudController extends CrudController
8
{
9
    /**
10
     * Prepare the admin interface by setting the associated
11
     * model, setting the route, and adding custom columns/fields.
12
     *
13
     * @return void
14
     */
15
    public function setup() : void
16
    {
17
        $this->crud->setModel("App\Models\Manager");
18
        $this->crud->setRoute("admin/manager");
19
        $this->crud->setEntityNameStrings('manager', 'managers');
20
21
        $this->crud->denyAccess('create');
22
        $this->crud->denyAccess('delete');
23
24
        $this->crud->addColumn([
25
            'name' => 'user.name',
26
            'type' => 'text',
27
            'label' => 'Name'
28
        ]);
29
        $this->crud->addColumn([
30
            'name' => 'user.email',
31
            'type' => 'text',
32
            'label' => 'Email'
33
        ]);
34
35
        $this->crud->removeButton('update');
36
        $this->crud->addButtonFromView('line', 'create_job_poster', 'create_job_poster', 'beginning');
37
    }
38
}
39