From 2efd5f85c4c6cf185a822d9c4496f5b1223ba8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 29 Jun 2021 10:17:43 +0200 Subject: [PATCH] submit ticket allow for admin --- app/Http/Requests/StoreTicket.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Requests/StoreTicket.php b/app/Http/Requests/StoreTicket.php index 306b01a..741d9e8 100644 --- a/app/Http/Requests/StoreTicket.php +++ b/app/Http/Requests/StoreTicket.php @@ -37,9 +37,12 @@ class StoreTicket extends FormRequest 'exists:projects,id', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed function ($attribute, $value, $fail) { + if (auth()->user()->role->equals(Role::admin())) { + return; + } if (!in_array($value, auth()->user()->projects()->pluck('id')->all())) { $fail(__('Veuillez choisir entre :values', [ - 'value' => auth()->user()->projects()->pluck('name')->implode(',') + 'values' => auth()->user()->projects()->pluck('name')->implode(',') ])); } }