Extend customers' information.

This commit is contained in:
2025-02-03 14:41:53 +01:00
parent 2c32b51058
commit ade1bfb863
5 changed files with 123 additions and 37 deletions

View File

@@ -23,6 +23,14 @@ class CustomerController extends Controller
return view('customer.create');
}
/**
* Display the specified resource.
*/
public function show(Customer $customer): View
{
return view('customer.show', ['customer' => $customer->load(['addresses', 'invoices'])]);
}
/**
* Show the form for editing the specified resource.

View File

@@ -92,4 +92,12 @@ class Customer extends Model
{
return $this->hasMany(Address::class);
}
/**
* Get all customer's invoices.
*/
public function invoices(): HasMany
{
return $this->hasMany(Invoice::class);
}
}