Completed
Push — master ( b877df...b3f08b )
by Christopher
01:17
created

ValidatePostRequest::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Chriscreates\Blog\Requests;
4
5
use Chriscreates\Blog\Rules\ValidateCategoryId;
6
use Chriscreates\Blog\Rules\ValidateTagIds;
7
use Illuminate\Foundation\Http\FormRequest;
8
9
class ValidatePostRequest 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
            'category_id' => ['nullable', new ValidateCategoryId],
30
            'user_id' => 'nullable',
31
            'tags' => ['nullable', new ValidateTagIds],
32
            'title' => 'required|string|max:150',
33
            'sub_title' => 'nullable|string',
34
            'slug' => 'nullable|string',
35
            'excerpt' => 'nullable|string',
36
            'content' => 'nullable',
37
            'allow_comments' => 'nullable|boolean',
38
            'allow_guest_comments' => 'nullable|boolean',
39
            'status' => 'nullable',
40
            'published_at' => 'string|nullable',
41
        ];
42
    }
43
}
44