32 lines
676 B
PHP
32 lines
676 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
use App\Models\Client;
|
|
class ClientsController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
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'));
|
|
}
|
|
}
|