check()) { return false; } /** @var \App\Models\User */ $user = auth()->user(); return $user->isAdmin() and $user->can('credit', $this->account); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'amount' => [ 'required', 'numeric', 'gt:0', function ($attribute, $value, $fail) { if ((\floatval($value) * 10) % 5 !== 0) { $fail("$attribute doit ĂȘtre un multiple de 5 (comptez par demi journĂ©es, soit 0.5)"); } } ], ]; } }