Passed
Push — master ( d29a9b...25ab8d )
by Curtis
08:54 queued 03:38
created

Store::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\enso\permissions;
4
5
use Illuminate\Routing\Controller;
6
use Laravelenso\permissions\Http\Requests\ValidatePermissionRequest;
7
use App\Models\enso\permissions\Permission;
8
9
class Store extends Controller
10
{
11
    public function __invoke(ValidatePermissionRequest $request, Permission $permission)
12
    {
13
        $permission = $permission->storeWithRoles(
14
            $request->validatedExcept('roles'),
15
            $request->get('roles'),
0 ignored issues
show
Bug introduced by
It seems like $request->get('roles') can also be of type null; however, parameter $roles of App\Models\enso\Permissi...ssion::storeWithRoles() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

15
            /** @scrutinizer ignore-type */ $request->get('roles'),
Loading history...
16
        );
17
18
        return [
19
            'message' => __('The permission was created!'),
20
            'redirect' => 'system.permissions.edit',
21
            'param' => ['permission' => $permission->id],
22
        ];
23
    }
24
}
25