isMethod('PUT')) { return auth('sanctum')->check(); } return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if ($this->isMethod('PUT')) { return []; } if ($this->path() == 'api/login') { return [ 'email' => 'required|email', 'password' => 'required', ]; } return [ 'email' => 'required|email', 'password' => 'required', 'name' => 'nullable|string', ]; } }