Files

32 lines
676 B
PHP
Raw Permalink Normal View History

2026-09-16 11:43:27 +02:00
<?php
namespace App\Http\Controllers;
2026-09-16 12:08:49 +02:00
use App\Models\Client;
2026-09-16 11:43:27 +02:00
class ClientsController extends Controller
{
public function index()
{
return $this->renderClients(Client::all());
2026-09-16 11:43:27 +02:00
}
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'));
}
}