validate([ 'invoice_prefix' => 'required|string|max:20', 'invoice_next_number' => 'required|integer|min:1', 'header_name' => 'nullable|string|max:100', 'header_title' => 'nullable|string|max:150', 'header_logo' => 'nullable|image|max:2048', 'default_tax_rate' => 'nullable|numeric|min:0|max:100', 'default_currency' => 'nullable|string|max:10', 'default_service_description'=> 'nullable|string|max:255', 'default_bank_name' => 'nullable|string|max:100', 'default_branch_name' => 'nullable|string|max:100', 'default_bank_account' => 'nullable|string|max:50', 'default_bank_holder' => 'nullable|string|max:100', 'default_notes' => 'nullable|string|max:1000', ]); $settings = InvoiceSettings::instance(); if ($request->hasFile('header_logo')) { // Delete old logo if exists if ($settings->header_logo) { Storage::disk('public')->delete($settings->header_logo); } $path = $request->file('header_logo')->store('invoice-logos', 'public'); $validated['header_logo'] = $path; } $settings->update($validated); return redirect()->route('invoice-settings.edit') ->with('success', '🧾 Invoice settings saved!'); } }