ValidatePostRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A rules() 0 17 1
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