CityStoreRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 25
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 7 1
A authorize() 0 3 1
1
<?php
2
3
namespace Turahe\Master\Http\Requests\City;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Validation\Rule;
7
use Turahe\Master\Models\City;
8
9
class CityStoreRequest extends FormRequest
10
{
11
    /**
12
     * Get the validation rules that apply to the request.
13
     *
14
     * @return array
15
     */
16
    public function rules()
17
    {
18
        return [
19
            'id' => ['required', 'max:4', Rule::unique((new City())->getTable())->ignore($this->previous_id, 'id')],
20
            'name' => ['required'],
21
            'province_id' => ['required'],
22
            'meta' => 'nullable',
23
        ];
24
    }
25
26
    /**
27
     * Determine if the user is authorized to make this request.
28
     *
29
     * @return bool
30
     */
31
    public function authorize()
32
    {
33
        return true;
34
    }
35
}
36