UpdateRequest::attributes()   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
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Requests\Settings;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class UpdateRequest extends FormRequest
8
{
9
    /**
10
     * Determine if the user is authorized to make this request.
11
     *
12
     * @return bool
13
     */
14
    public function authorize()
15
    {
16
        return true;
17
    }
18
19
    /**
20
     * Get the validation rules that apply to the request.
21
     *
22
     * @return array
23
     */
24
    public function rules()
25
    {
26
        return [
27
            'enrollments_start_at' => 'required|date',
28
            'enrollments_end_at' => 'required|date|after:enrollments_start_at',
29
            'exchanges_start_at' => 'required|date|after_or_equal:enrollments_start_at',
30
            'exchanges_end_at' => 'required|date|after:exchanges_start_at',
31
        ];
32
    }
33
34
    /**
35
     * Get custom attributes for validator errors.
36
     *
37
     * @return array
38
     */
39
    public function attributes()
40
    {
41
        return [
42
            'enrollments_start_at' => 'begin date of the enrollments period',
43
            'enrollments_end_at' => 'end date of the enrollments period',
44
            'exchanges_start_at' => 'begin date of the exchanges period',
45
            'exchanges_end_at' => 'end date of the exchanges period',
46
        ];
47
    }
48
}
49