Jenkins file
Laverie/backend/pipeline/head There was a failure building this commit

This commit is contained in:
bastien
2026-07-04 22:42:58 +02:00
parent 10ee859602
commit d95bfa6c58
244 changed files with 16 additions and 15 deletions
@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Concerns\RespondsWithJson;
use App\Http\Resources\EstablishmentResource;
use App\Models\Establishment;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class EstablishmentController extends Controller
{
use RespondsWithJson;
public function index(Request $request): JsonResponse
{
$establishments = Establishment::query()
->where('is_active', true)
->when($request->filled('city'), fn ($q) => $q->where('city', $request->string('city')->toString()))
->orderBy('name')
->get();
return $this->success([
'establishments' => EstablishmentResource::collection($establishments),
]);
}
public function show(string $uuid): JsonResponse
{
$establishment = Establishment::query()
->where('uuid', $uuid)
->where('is_active', true)
->with(['machines' => fn ($q) => $q->orderBy('name')])
->firstOrFail();
return $this->success([
'establishment' => new EstablishmentResource($establishment),
]);
}
}