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

InitialStateRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 3 2
A rules() 0 5 1
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