From 59bb0a3fbd43a31d5567275c813f8f08868b9f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 18 May 2021 19:33:36 +0200 Subject: [PATCH] Only admins can change ticket status --- app/Http/Requests/ChangeTicketStatus.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Http/Requests/ChangeTicketStatus.php b/app/Http/Requests/ChangeTicketStatus.php index 4d681d0..f66afef 100644 --- a/app/Http/Requests/ChangeTicketStatus.php +++ b/app/Http/Requests/ChangeTicketStatus.php @@ -7,6 +7,17 @@ use Illuminate\Foundation\Http\FormRequest; class ChangeTicketStatus extends FormRequest { + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return auth()->check() and + auth()->user()->role === 1; + } + /** * Get the validation rules that apply to the request. *