isMethod('POST')) { return [ 'username' => 'required', 'password' => 'required', 'access_token' => 'required', ]; } // Validation rule for update request. if ($request->isMethod('PUT') || $request->isMethod('PATCH')) { return [ 'username' => 'required', 'password' => 'required', 'access_token' => 'required', ]; } // Default validation rule. return [ ]; } }