| Total Complexity | 5 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class BatchUpdateApplicationReview extends FormRequest |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Determine if the user is authorized to make this request. |
||
| 12 | * |
||
| 13 | * @return bool |
||
| 14 | */ |
||
| 15 | public function authorize() |
||
| 16 | { |
||
| 17 | $user = $this->user(); |
||
| 18 | if ($user === null) { |
||
| 19 | return false; |
||
| 20 | } |
||
| 21 | |||
| 22 | $inputIds = collect($this->all())->pluck('id')->all(); |
||
|
|
|||
| 23 | $applicationReviews = ApplicationReview::whereIn('id', $inputIds)->get(); |
||
| 24 | |||
| 25 | foreach ($applicationReviews as $applicationReview) { |
||
| 26 | if (!$user->can('update', $applicationReview)) { |
||
| 27 | return false; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | return true; |
||
| 31 | } |
||
| 32 | |||
| 33 | |||
| 34 | /** |
||
| 35 | * Get the validation rules that apply to the request. |
||
| 36 | * |
||
| 37 | * @return array |
||
| 38 | */ |
||
| 39 | public function rules() |
||
| 49 | ]; |
||
| 50 | } |
||
| 52 |