Réalisation du tp3, tp4, tp5 et tp6 avec documentation.

This commit is contained in:
2026-10-07 00:48:56 +02:00
parent fc4c55546f
commit 4a84a17cbf
40 changed files with 1584 additions and 120 deletions
@@ -6,40 +6,26 @@ class ClientsController extends Controller
{
public function index()
{
{
// $clients = Client::all();
// return view('clients.index', [
// 'clients' => $clients
// ]);
// }
// $clients = Client::where('city', 'Paris')->get();
// $clients = Client::where('name', 'like', '%Martin%')->get();
$clients = Client::find(1);
return view('clients.index', [
'clients' => $clients
]);
}
// $clients = [
// [
// 'name' => 'Jean Dupont',
// 'email' => 'jean@example.com',
// 'city' => 'Paris'
// ],
// [
// 'name' => 'Marie Martin',
// 'email' => 'marie@example.com',
// 'city' => 'Lyon'
// ],
// [
// 'name' => 'Paul Durand',
// 'email' => 'paul@example.com',
// 'city' => 'Marseille'
// ]
// ];
// return view('clients', ['clients' => $clients]);
return $this->renderClients(Client::all());
}
}
public function paris()
{
return $this->renderClients(Client::where('city', 'Paris')->get());
}
public function martin()
{
return $this->renderClients(Client::where('name', 'like', '%Martin%')->get());
}
public function second()
{
return $this->renderClients(collect([Client::findOrFail(2)]));
}
private function renderClients($clients)
{
return view('clients.index', compact('clients'));
}
}