Passed
Push — master ( 3b518a...cd2a02 )
by Adam
11:23
created

GuideRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 30
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 13 1
A authorize() 0 3 1
1
<?php
2
3
namespace Coyote\Http\Requests;
4
5
use Coyote\Guide\Role;
6
use Illuminate\Foundation\Http\FormRequest;
7
use Illuminate\Validation\Rule;
8
9
class GuideRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16
    public function authorize()
17
    {
18
        return true;
19
    }
20
21
    /**
22
     * Get the validation rules that apply to the request.
23
     *
24
     * @return array
25
     */
26
    public function rules()
27
    {
28
        return [
29
            'title' => 'required|string|max:200',
30
            'excerpt' => 'nullable|string',
31
            'text' => 'required|string',
32
            'tags' => 'required|max:6',
33
            'role' => ['required', Rule::in([Role::JUNIOR, Role::MID, Role::SENIOR])],
34
            'tags.*.name'   => [
35
                'bail',
36
                'max:25',
37
                'tag',
38
                'tag_creation:300'
39
            ]
40
        ];
41
    }
42
}
43