isMethod('POST')) { return [ 'name' => 'required', 'loan_amount' => 'required', 'first_paid_date' => 'required', 'payment_period' => 'required', 'client_id' => 'required', 'user_id' => 'required', ]; } // Validation rule for update request. if ($request->isMethod('PUT') || $request->isMethod('PATCH')) { return [ 'name' => 'required', 'loan_amount' => 'required', 'first_paid_date' => 'required', 'payment_period' => 'required', 'client_id' => 'required', 'user_id' => 'required', ]; } // Default validation rule. return [ ]; } }