DistrictStoreRequest::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Turahe\Master\Http\Requests\District;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Validation\Rule;
7
use Turahe\Master\Models\District;
8
9
class DistrictStoreRequest 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:8', Rule::unique((new District())->getTable())->ignore($this->previous_id, 'id')],
20
            'name' => ['required'],
21
            'city_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