| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 45 |