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
Push — master ( e56412...c69a02 )
by Cristian
01:31
created

src/app/Http/Controllers/RoleCrudController.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Backpack\PermissionManager\app\Http\Controllers;
4
5
use Backpack\CRUD\app\Http\Controllers\CrudController;
6
// VALIDATION
7
use Backpack\PermissionManager\app\Http\Requests\RoleCrudRequest as StoreRequest;
8
use Backpack\PermissionManager\app\Http\Requests\RoleCrudRequest as UpdateRequest;
9
10
class RoleCrudController extends CrudController
11
{
12
    public function setup()
13
    {
14
        $this->crud->setModel(config('laravel-permission.models.role'));
15
        $this->crud->setEntityNameStrings(trans('backpack::permissionmanager.role'), trans('backpack::permissionmanager.roles'));
16
        $this->crud->setRoute(config('backpack.base.route_prefix').'/role');
17
18
        $this->crud->setColumns([
19
            [
20
                'name'  => 'name',
21
                'label' => trans('backpack::permissionmanager.name'),
22
                'type'  => 'text',
23
            ],
24
            [
25
                // n-n relationship (with pivot table)
26
                'label'     => ucfirst(trans('backpack::permissionmanager.permission_plural')),
27
                'type'      => 'select_multiple',
28
                'name'      => 'permissions', // the method that defines the relationship in your Model
29
                'entity'    => 'permissions', // the method that defines the relationship in your Model
30
                'attribute' => 'name', // foreign key attribute that is shown to user
31
                'model'     => "Backpack\PermissionManager\app\Models\Permission", // foreign key model
32
                'pivot'     => true, // on create&update, do you need to add/delete pivot table entries?
33
            ],
34
        ]);
35
36
        $this->crud->addField([
37
            'name'  => 'name',
38
            'label' => trans('backpack::permissionmanager.name'),
39
            'type'  => 'text',
40
        ]);
41
        $this->crud->addField([
42
            'label'     => ucfirst(trans('backpack::permissionmanager.permission_plural')),
43
            'type'      => 'checklist',
44
            'name'      => 'permissions',
45
            'entity'    => 'permissions',
46
            'attribute' => 'name',
47
            'model'     => "Backpack\PermissionManager\app\Models\Permission",
48
            'pivot'     => true,
49
        ]);
50
51
        if (config('backpack.permissionmanager.allow_role_create') == false) {
52
            $this->crud->denyAccess('create');
53
        }
54
        if (config('backpack.permissionmanager.allow_role_update') == false) {
55
            $this->crud->denyAccess('update');
56
        }
57
        if (config('backpack.permissionmanager.allow_role_delete') == false) {
58
            $this->crud->denyAccess('delete');
59
        }
60
    }
61
62
    public function store(StoreRequest $request)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
    {
64
        return parent::storeCrud();
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...
65
    }
66
67
    public function update(UpdateRequest $request)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
    {
69
        return parent::updateCrud();
70
    }
71
}
72