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

app/Http/Controllers/PermissionCrudController.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\PermissionCrudRequest as StoreRequest;
8
use Backpack\PermissionManager\app\Http\Requests\PermissionCrudRequest as UpdateRequest;
9
10
class PermissionCrudController extends CrudController
11
{
12
    public function setup()
13
    {
14
        $this->crud->setModel(config('laravel-permission.models.permission'));
15
        $this->crud->setEntityNameStrings(trans('backpack::permissionmanager.permission_singular'), trans('backpack::permissionmanager.permission_plural'));
16
        $this->crud->setRoute(config('backpack.base.route_prefix').'/permission');
17
18
        $this->crud->addColumn([
19
            'name'  => 'name',
20
            'label' => trans('backpack::permissionmanager.name'),
21
            'type'  => 'text',
22
        ]);
23
        $this->crud->addColumn([ // n-n relationship (with pivot table)
24
            'label'     => trans('backpack::permissionmanager.roles_have_permission'),
25
            'type'      => 'select_multiple',
26
            'name'      => 'roles',
27
            'entity'    => 'roles',
28
            'attribute' => 'name',
29
            'model'     => "Backpack\PermissionManager\app\Models\Role",
30
            'pivot'     => true,
31
        ]);
32
33
        $this->crud->addField([
34
            'name'  => 'name',
35
            'label' => trans('backpack::permissionmanager.name'),
36
            'type'  => 'text',
37
        ]);
38
        $this->crud->addField([
39
            'label'     => trans('backpack::permissionmanager.roles'),
40
            'type'      => 'checklist',
41
            'name'      => 'roles',
42
            'entity'    => 'roles',
43
            'attribute' => 'name',
44
            'model'     => "Backpack\PermissionManager\app\Models\Role",
45
            'pivot'     => true,
46
        ]);
47
48
        if (!config('backpack.permissionmanager.allow_permission_create')) {
49
            $this->crud->denyAccess('create');
50
        }
51
        if (!config('backpack.permissionmanager.allow_permission_update')) {
52
            $this->crud->denyAccess('update');
53
        }
54
        if (!config('backpack.permissionmanager.allow_permission_delete')) {
55
            $this->crud->denyAccess('delete');
56
        }
57
    }
58
59
    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...
60
    {
61
        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...
62
    }
63
64
    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...
65
    {
66
        return parent::updateCrud();
67
    }
68
}
69