Passed
Push — task/comments-api ( 6d7a22 )
by Yonathan
13:12
created

StoreComment::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Requests;
4
5
use App\Models\JobPoster;
6
use App\Models\Lookup\CommentType;
7
use App\Models\User;
8
use App\Services\Validation\Rules\ValidIdRule;
9
use Illuminate\Foundation\Http\FormRequest;
10
11
class StoreComment extends FormRequest
12
{
13
    /**
14
     * Determine if the user is authorized to make this request.
15
     *
16
     * @return bool
1 ignored issue
show
Coding Style introduced by
Expected "boolean" but found "bool" for function return type
Loading history...
17
     */
18
    public function authorize()
19
    {
20
        return true;
21
    }
22
23
    /**
24
     * Get the validation rules that apply to the request.
25
     *
26
     * @return array
27
     */
28
    public function rules()
29
    {
30
        return [
31
            'job_poster_id' => ['nullable', new ValidIdRule(JobPoster::class)],
32
            'user_id' => ['nullable', new ValidIdRule(User::class)],
33
            'comment' => 'nullable|string',
34
            'location' => 'nullable|string',
35
            'type_id' => ['nullable', new ValidIdRule(CommentType::class)]
36
        ];
37
    }
38
}
39