merge([ 'minimumrole' => optional(User::whereId($this->created_by)->first())->role ?? null ]); return auth()->check(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'created_by' => 'required|exists:users,id', 'minimumrole' => [new IsValidRole(), new HasMinimumRole('CONTRIBUTEUR')] ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'minimumrole' => trans('rĂ´le') ]; } }