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 (#46)
by Cristian
01:13
created

MenuItemCrudController::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\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
    use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
14
    use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
15
    use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
16
    use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
17
    use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
18
19
    public function setup()
20
    {
21
        $this->crud->setModel("Backpack\MenuCRUD\app\Models\MenuItem");
22
        $this->crud->setRoute(config('backpack.base.route_prefix').'/menu-item');
23
        $this->crud->setEntityNameStrings('menu item', 'menu items');
24
25
        $this->crud->enableReorder('name', 3);
26
27
        $this->crud->operation('list', function () {
0 ignored issues
show
Bug introduced by
The method operation() does not exist on Backpack\CRUD\CrudPanel. Did you maybe mean doingListOperation()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28
            $this->crud->addColumn([
29
                'name' => 'name',
30
                'label' => 'Label',
31
            ]);
32
            $this->crud->addColumn([
33
                'label' => 'Parent',
34
                'type' => 'select',
35
                'name' => 'parent_id',
36
                'entity' => 'parent',
37
                'attribute' => 'name',
38
                'model' => "\Backpack\MenuCRUD\app\Models\MenuItem",
39
            ]);
40
        });
41
42
        $this->crud->operation(['create', 'update'], function () {
0 ignored issues
show
Bug introduced by
The method operation() does not exist on Backpack\CRUD\CrudPanel. Did you maybe mean doingListOperation()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
43
            $this->crud->addField([
44
                'name' => 'name',
45
                'label' => 'Label',
46
            ]);
47
            $this->crud->addField([
48
                'label' => 'Parent',
49
                'type' => 'select',
50
                'name' => 'parent_id',
51
                'entity' => 'parent',
52
                'attribute' => 'name',
53
                'model' => "\Backpack\MenuCRUD\app\Models\MenuItem",
54
            ]);
55
            $this->crud->addField([
56
                'name' => 'type',
57
                'label' => 'Type',
58
                'type' => 'page_or_link',
59
                'page_model' => '\Backpack\PageManager\app\Models\Page',
60
            ]);
61
        });
62
    }
63
64
    public function store(StoreRequest $request)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
65
    {
66
        return $this->storeEntry($request);
0 ignored issues
show
Documentation Bug introduced by
The method storeEntry does not exist on object<Backpack\MenuCRUD...MenuItemCrudController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
67
    }
68
69
    public function update(UpdateRequest $request)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
70
    {
71
        return $this->updateEntry($request);
0 ignored issues
show
Documentation Bug introduced by
The method updateEntry does not exist on object<Backpack\MenuCRUD...MenuItemCrudController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
72
    }
73
}
74