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

StoreComment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

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