Passed
Push — task/talent-dot-test ( 0ef1e8...074f28 )
by Grant
08:57 queued 03:14
created

ManagerCrudController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 16
dl 0
loc 30
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setup() 0 22 1
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