Passed
Push — develop ( 3db2fb...b27e40 )
by Septianata
05:11
created

UpdateRequest::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Http\Requests\Branch;
4
5
use App\Models\Branch;
6
use Illuminate\Foundation\Http\FormRequest;
7
use Illuminate\Validation\Rule;
8
9
class UpdateRequest extends FormRequest
10
{
11
    /**
12
     * {@inheritDoc}
13
     */
14 1
    public function authorize()
15
    {
16 1
        return !is_null($this->user());
17
    }
18
19
    /**
20
     * {@inheritDoc}
21
     */
22 1
    public function rules()
23
    {
24
        return [
25 1
            'name' => ['required', 'string', 'max:255', Rule::unique(Branch::class)->ignoreModel($this->route('branch'))],
26 1
            'address' => 'required|string',
27 1
            'address_latitude' => 'required|numeric',
28 1
            'address_longitude' => 'required|numeric',
29 1
            'google_map_url' => 'sometimes|nullable|string|max:255',
30
        ];
31
    }
32
}
33