Passed
Push — master ( c8d9e7...74071b )
by Adam
06:17
created

InitialStateRequest::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 InitialStateRequest extends FormRequest
9
{
10 2
    public function authorize()
11
    {
12 2
        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 2
    public function rules()
16
    {
17
        return [
18 2
            'rooms'    => 'required|numeric|min:1',
19
            'guests'   => 'required|numeric|min:1',
20
        ];
21
    }
22
}
23