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()
|
|
|
|
|
{
|
2026-10-07 00:48:56 +02:00
|
|
|
return $this->renderClients(Client::all());
|
2026-09-16 11:43:27 +02:00
|
|
|
}
|
2026-10-07 00:48:56 +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'));
|
|
|
|
|
}
|
|
|
|
|
}
|