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
35 lines
923 B
PHP
35 lines
923 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreSaisieRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'emotion_id' => 'required|exists:emotions,id',
|
|
'intensite' => 'required|integer|between:1,10',
|
|
'note' => 'nullable|string|max:2000',
|
|
'date_saisie' => 'required|date',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'emotion_id.required' => 'L\'émotion est obligatoire.',
|
|
'emotion_id.exists' => 'Cette émotion n\'existe pas.',
|
|
'intensite.required' => 'L\'intensité est obligatoire.',
|
|
'intensite.between' => 'L\'intensité doit être entre 1 et 10.',
|
|
'date_saisie.required' => 'La date est obligatoire.',
|
|
];
|
|
}
|
|
}
|