feat: initialisation complète du projet CESIZen
- 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
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreFeedRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'titre' => 'required|string|max:255',
|
||||
'contenu' => 'required|string',
|
||||
'image_url' => 'nullable|string|max:500',
|
||||
'est_publie' => 'boolean',
|
||||
'ordre' => 'integer|min:0',
|
||||
];
|
||||
|
||||
if ($this->isMethod('POST')) {
|
||||
$rules['slug'] = 'nullable|string|max:255|unique:feeds,slug';
|
||||
} else {
|
||||
$rules['slug'] = [
|
||||
'nullable',
|
||||
'string',
|
||||
'max:255',
|
||||
Rule::unique('feeds', 'slug')->ignore($this->route('id')),
|
||||
];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user