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 (#23)
by
unknown
01:47
created

MenuItemCrudController::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Backpack\MenuCRUD\app\Http\Controllers\Admin;
4
5
use App\Http\Requests;
6
use Backpack\CRUD\app\Http\Controllers\CrudController;
7
// VALIDATION: change the requests to match your own file names if you need form validation
8
use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest;
9
use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest;
10
11
class MenuItemCrudController extends CrudController
12
{
13
    public function __construct()
14
    {
15
        parent::__construct();
16
17
        $this->crud->setModel("Backpack\MenuCRUD\app\Models\MenuItem");
18
        $this->crud->setRoute(config('backpack.base.route_prefix').'/menu-item');
19
        $this->crud->setEntityNameStrings('menu item', 'menu items');
20
21
        $this->crud->allowAccess('reorder');
22
        $this->crud->enableReorder('name', 2);
23
24
        $this->crud->addColumn([
25
                                'name' => 'name',
26
                                'label' => 'Label',
27
                            ]);
28
        $this->crud->addColumn([
29
                                'label' => 'Parent',
30
                                'type' => 'select',
31
                                'name' => 'parent_id',
32
                                'entity' => 'parent',
33
                                'attribute' => 'name',
34
                                'model' => "\Backpack\MenuCRUD\app\Models\MenuItem",
35
                            ]);
36
37
        $this->crud->addColumn([
38
                                'label' => 'Menu Label',
39
                                'type' => 'select',
40
                                'name' => 'menu_id',
41
                                'entity' => 'menu',
42
                                'attribute' => 'name',
43
                                'model' => "\Backpack\MenuCRUD\app\Models\Menu",
44
                            ]);
45
46
        $this->crud->addField([
47
                                'name' => 'name',
48
                                'label' => 'Label',
49
                            ]);
50
        $this->crud->addField([
51
                                'label' => 'Parent',
52
                                'type' => 'select',
53
                                'name' => 'parent_id',
54
                                'entity' => 'parent',
55
                                'attribute' => 'name',
56
                                'model' => "\Backpack\MenuCRUD\app\Models\MenuItem",
57
                            ]);
58
        $this->crud->addField([
59
                                'label' => 'Menu',
60
                                'type' => 'select',
61
                                'name' => 'menu_id',
62
                                'entity' => 'parent',
63
                                'attribute' => 'name',
64
                                'model' => "\Backpack\MenuCRUD\app\Models\Menu",
65
                            ]);
66
        $this->crud->addField([
67
                                'name' => 'type',
68
                                'label' => 'Type',
69
                                'type' => 'page_or_link',
70
                                'page_model' => '\Backpack\PageManager\app\Models\Page',
71
                            ]);
72
    }
73
74
    public function store(StoreRequest $request)
75
    {
76
        return parent::storeCrud($request);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (storeCrud() instead of store()). Are you sure this is correct? If so, you might want to change this to $this->storeCrud().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
77
    }
78
79
    public function update(UpdateRequest $request)
80
    {
81
        return parent::updateCrud($request);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (updateCrud() instead of update()). Are you sure this is correct? If so, you might want to change this to $this->updateCrud().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
82
    }
83
}
84