Passed
Push — master ( 181c26...37f6d6 )
by Adam
05:50
created

UserAddRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 2
cp 0
crap 2
rs 9.4285
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
    public function authorize()
11
    {
12
        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
    public function rules()
16
    {
17
        return [
18
            '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