e3da625927
- Backend Laravel 11 (API REST, JWT auth, PostgreSQL) - Frontend Next.js 14 (React, TypeScript, Tailwind CSS) - Docker Compose (PostgreSQL, backend, frontend) - Modules : auth, profil, tracker émotions, informations, admin
23 lines
478 B
PHP
23 lines
478 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Emotion;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class EmotionController extends Controller
|
|
{
|
|
public function index(): JsonResponse
|
|
{
|
|
$emotions = Emotion::actives()
|
|
->niveau(1)
|
|
->with(['enfants' => function ($query) {
|
|
$query->actives()->orderBy('nom');
|
|
}])
|
|
->orderBy('nom')
|
|
->get();
|
|
|
|
return response()->json($emotions);
|
|
}
|
|
}
|