Passed
Push — master ( 020590...b74985 )
by Adam
06:43
created

UserAddRequest::authorize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Facades\Auth;
7
8
class UserAddRequest extends FormRequest
9
{
10 6
    public function authorize()
11
    {
12 6
        return Auth::check() && Auth::user()->isAdmin();
0 ignored issues
show
Bug introduced by
The method isAdmin() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

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

12
        return Auth::check() && Auth::user()->/** @scrutinizer ignore-call */ isAdmin();
Loading history...
13
    }
14
15 6
    public function rules()
16
    {
17
        return [
18 6
            'name'     => 'required|string|max:255',
19
            'email'    => 'required|string|email|max:255|unique:users',
20
            'password' => 'required|string|min:6|confirmed',
21
        ];
22
    }
23
}
24