Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#35)
by Cristian
01:15
created

CategoryCrudController::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Backpack\NewsCRUD\app\Http\Controllers\Admin;
4
5
use Backpack\CRUD\CrudPanelFacade as CRUD;
6
use Backpack\CRUD\app\Http\Controllers\CrudController;
7
use Backpack\NewsCRUD\app\Http\Requests\CategoryRequest;
8
9
class CategoryCrudController extends CrudController
10
{
11
    use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
12
    use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
13
    use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
14
    use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
15
    use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
16
    use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
17
18
    public function setup()
19
    {
20
        CRUD::setModel("Backpack\NewsCRUD\app\Models\Category");
21
        CRUD::setRoute(config('backpack.base.route_prefix', 'admin').'/category');
22
        CRUD::setEntityNameStrings('category', 'categories');
23
    }
24
25
    protected function setupListOperation()
26
    {
27
        CRUD::addColumn('name');
28
        CRUD::addColumn('slug');
29
        CRUD::addColumn([
30
            'label' => 'Parent',
31
            'type' => 'select',
32
            'name' => 'parent_id',
33
            'entity' => 'parent',
34
            'attribute' => 'name',
35
        ]);
36
    }
37
38
    protected function setupShowOperation()
39
    {
40
        return $this->setupListOperation();
41
    }
42
43
    protected function setupCreateOperation()
44
    {
45
        CRUD::setValidation(CategoryRequest::class);
46
47
        CRUD::addField([
48
            'name' => 'name',
49
            'label' => 'Name',
50
        ]);
51
        CRUD::addField([
52
            'name' => 'slug',
53
            'label' => 'Slug (URL)',
54
            'type' => 'text',
55
            'hint' => 'Will be automatically generated from your name, if left empty.',
56
            // 'disabled' => 'disabled'
57
        ]);
58
        CRUD::addField([
59
            'label' => 'Parent',
60
            'type' => 'select',
61
            'name' => 'parent_id',
62
            'entity' => 'parent',
63
            'attribute' => 'name',
64
        ]);
65
    }
66
67
    protected function setupUpdateOperation()
68
    {
69
        $this->setupCreateOperation();
70
    }
71
72
    protected function setupReorderOperation()
73
    {
74
        CRUD::set('reorder.label', 'name');
75
        CRUD::set('reorder.max_level', 2);
76
    }
77
}
78