merge([ 'cash' => removeRupiahFormatting($this->cash), ]); } public function rules(): array { $isEdit = $this->isMethod('put'); return [ 'name' => ['required', 'string', 'max:50'], 'contact_number' => ['required', 'string', 'regex:/^\+?\d{10,15}$/'], 'landmark' => ['required', 'string', 'max:30'], 'address' => ['required', 'string', 'max:65535'], 'opened' => ['required', 'date'], 'closed' => ['nullable', 'date'], 'cash' => ['required', 'numeric', 'min:0', 'max:99999999.99'], 'image' => $isEdit ? ['nullable', 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048'] : ['required', 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048'], ]; } protected function failedValidation(Validator $validator): void { $this->handleValidationFailure($validator); } }