Car-Repairs-Shop/app/Http/Controllers/CustomerController.php
sackey e839d40a99
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Initial commit
2025-07-30 17:15:50 +00:00

72 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Customer;
class CustomerController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('customers.index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('customers.create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// This is handled by the Livewire component
return redirect()->route('customers.index');
}
/**
* Display the specified resource.
*/
public function show(Customer $customer)
{
// Load relationships for the show page
$customer->load(['vehicles', 'serviceOrders.vehicle', 'serviceOrders.assignedTechnician', 'appointments']);
return view('customers.show', compact('customer'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Customer $customer)
{
return view('customers.edit', compact('customer'));
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Customer $customer)
{
// This is handled by the Livewire component
return redirect()->route('customers.show', $customer);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Customer $customer)
{
$customer->delete();
return redirect()->route('customers.index')->with('success', 'Customer deleted successfully.');
}
}