Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class StoreRatingGuideAnswer extends FormRequest |
||
12 | { |
||
13 | /** |
||
14 | * Determine if the user is authorized to make this request. |
||
15 | * |
||
16 | * @return bool |
||
1 ignored issue
–
show
|
|||
17 | */ |
||
18 | public function authorize() |
||
19 | { |
||
20 | // Ensure the user can make answers, and is the owner of the question it answers. |
||
21 | if ($this->user()->can('create', RatingGuideAnswer::class)) { |
||
22 | $questionId = (int) $this->input("rating_guide_question_id"); |
||
23 | if ($questionId) { |
||
24 | $question = RatingGuideQuestion::find($questionId); |
||
25 | return $question && $question->job_poster->manager->user_id === $this->user()->id; |
||
26 | } |
||
27 | } |
||
28 | return false; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Get the validation rules that apply to the request. |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | public function rules() |
||
42 | ]; |
||
43 | } |
||
45 |