merge([ 'role' => 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', 'role' => [new IsValidRole(), new HasMinimumRole('CONTRIBUTEUR')] ]; } }