feat: add whatsapp_number field to supplier and customer forms
This commit is contained in:
1 parent
34e095526f
commit
12751ab39c
6 files changed
+71
-19
No files matched your search
@@ -22,14 +22,21 @@ class CustomerController extends Controller
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'address' => 'nullable|string',
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'whatsapp_number' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string',
|
||||
'contact_person' => 'nullable|string|max:255',
|
||||
'tax_number' => 'nullable|string|max:50',
|
||||
'credit_limit' => 'nullable|numeric|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
]);
|
||||
|
||||
Customer::create($request->all());
|
||||
$validated['is_active'] = (bool) $request->input('is_active', 1);
|
||||
|
||||
Customer::create($validated);
|
||||
|
||||
return redirect()->route('sales.customers.index')->with('success', 'Customer created successfully.');
|
||||
}
|
||||
@@ -46,14 +53,21 @@ class CustomerController extends Controller
|
||||
|
||||
public function update(Request $request, Customer $customer)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'address' => 'nullable|string',
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'whatsapp_number' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string',
|
||||
'contact_person' => 'nullable|string|max:255',
|
||||
'tax_number' => 'nullable|string|max:50',
|
||||
'credit_limit' => 'nullable|numeric|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
]);
|
||||
|
||||
$customer->update($request->all());
|
||||
$validated['is_active'] = (bool) $request->input('is_active', 0);
|
||||
|
||||
$customer->update($validated);
|
||||
|
||||
return redirect()->route('sales.customers.index')->with('success', 'Customer updated successfully.');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user