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:
+30
@@ -0,0 +1,30 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
vendor/
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Build
|
||||
.next/
|
||||
out/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Cache
|
||||
.phpunit.result.cache
|
||||
storage/framework/cache/*
|
||||
storage/framework/sessions/*
|
||||
storage/framework/views/*
|
||||
bootstrap/cache/*
|
||||
@@ -0,0 +1,204 @@
|
||||
# CESIZen — Application de santé mentale
|
||||
|
||||
## Projet
|
||||
Projet CESI École d'Ingénieurs — Bloc "Concevoir les solutions logicielles" (INFCDAAL1).
|
||||
Plateforme web de gestion du stress et suivi émotionnel pour le Ministère des Solidarités et de la Santé.
|
||||
|
||||
## Stack technique
|
||||
- **Backend** : Laravel 11 (PHP 8.2+) — API REST, architecture MVC
|
||||
- **Frontend** : Next.js 14 (React + TypeScript + Tailwind CSS) — App Router, `src/` dir
|
||||
- **BDD** : PostgreSQL 16 (via Docker)
|
||||
- **Auth** : JWT (`tymon/jwt-auth`)
|
||||
- **Dépendances frontend** : axios, zustand, @tanstack/react-query, recharts, next-themes, lucide-react, react-hot-toast
|
||||
|
||||
## Charte graphique
|
||||
- Couleur principale : `#fce117` (Candlelight / jaune) — Tailwind: `candlelight-*`
|
||||
- Couleur secondaire : `#06c656` (Malachite / vert) — Tailwind: `malachite-*`
|
||||
- Couleur tertiaire : `#000000` (noir)
|
||||
- Polices : Inter (body, `font-sans`), Poppins (titres, `font-display`)
|
||||
- Dark mode supporté (next-themes, class strategy)
|
||||
- Mobile-first, RGAA accessible
|
||||
|
||||
## Modules implémentés
|
||||
1. **Comptes utilisateurs** (obligatoire) — inscription, profil, admin CRUD, reset password
|
||||
2. **Informations** (obligatoire) — pages de contenu CMS, CRUD admin
|
||||
3. **Tracker d'émotions** (au choix) — journal émotionnel, saisies, rapports graphiques
|
||||
|
||||
## État d'avancement
|
||||
|
||||
### FAIT (backend)
|
||||
- Projet Laravel initialisé avec JWT configuré
|
||||
- Config auth.php : guard `api` avec driver `jwt`, provider `utilisateurs` (modèle Utilisateur)
|
||||
- Config cors.php : frontend localhost:3000 autorisé
|
||||
- 10 migrations créées (roles, utilisateurs, emotions, trackers, saisie_trackers, feeds, contacts_urgence, audits, cache, sessions)
|
||||
- 8 modèles Eloquent (Role, Utilisateur avec JWTSubject, Emotion, Tracker, SaisieTracker, Feed, ContactUrgence, Audit)
|
||||
- 5 seeders (RoleSeeder, AdminSeeder admin@cesizen.fr/Admin123!, EmotionSeeder 7 émotions + sous-émotions, FeedSeeder 4 articles)
|
||||
- 3 middleware (JwtMiddleware, RoleMiddleware, ForceJsonResponse)
|
||||
- 5 Form Requests (RegisterRequest, LoginRequest, UpdateProfilRequest, StoreSaisieRequest, StoreFeedRequest)
|
||||
- 8 controllers (AuthController, ProfilController, FeedController, EmotionController, SaisieTrackerController, + 3 Admin)
|
||||
- RapportService (stats émotions par période week/month/quarter/year)
|
||||
- Routes API v1 complètes dans routes/api.php
|
||||
- bootstrap/app.php configuré avec middleware alias et routing API
|
||||
|
||||
### FAIT (frontend)
|
||||
- Projet Next.js 14 initialisé avec Tailwind, TypeScript, App Router
|
||||
- tailwind.config.ts avec couleurs candlelight/malachite + polices Inter/Poppins
|
||||
- globals.css avec import Google Fonts + variables CSS dark/light
|
||||
- layout.tsx avec providers (ThemeProvider, QueryClientProvider, Toaster)
|
||||
- Providers.tsx (composant client wrapper)
|
||||
- .env.local avec NEXT_PUBLIC_API_URL
|
||||
- src/lib/api.ts (client Axios avec intercepteurs JWT)
|
||||
- src/lib/auth-store.ts (store Zustand avec persist)
|
||||
- src/types/index.ts (interfaces TypeScript complètes)
|
||||
- 5 hooks (useAuth, useFeeds, useTracker, useRapport, useEmotions)
|
||||
- 7 composants UI (Button, Input, Card, Modal, Badge, Slider, Skeleton, ThemeToggle)
|
||||
- 3 composants layout (Header, Footer, Sidebar)
|
||||
- Page d'accueil (landing page avec hero, features, CTA)
|
||||
- Page /connexion (formulaire login)
|
||||
- Page /inscription (formulaire register avec consentement RGPD)
|
||||
|
||||
### À FAIRE (prioritaire)
|
||||
- **Lancer Docker PostgreSQL** (`docker compose up -d`) — Docker n'était pas démarré
|
||||
- **Migrer la BDD** (`cd backend && php artisan migrate --seed`)
|
||||
- **Tester l'API** (`php artisan serve` puis tester login/register)
|
||||
- Pages frontend manquantes :
|
||||
- `(public)/informations/page.tsx` — liste des articles
|
||||
- `(public)/informations/[slug]/page.tsx` — détail article
|
||||
- `(protected)/dashboard/page.tsx` — tableau de bord utilisateur
|
||||
- `(protected)/profil/page.tsx` — page profil
|
||||
- `(protected)/journal/page.tsx` — journal d'émotions (timeline)
|
||||
- `(protected)/journal/nouvelle-saisie/page.tsx` — formulaire saisie multi-étapes
|
||||
- `(protected)/journal/rapports/page.tsx` — graphiques recharts
|
||||
- `(admin)/admin/dashboard/page.tsx` — dashboard admin
|
||||
- `(admin)/admin/utilisateurs/page.tsx` — gestion utilisateurs
|
||||
- `(admin)/admin/contenus/page.tsx` — gestion contenus
|
||||
- `(admin)/admin/emotions/page.tsx` — gestion émotions
|
||||
- Layout protégé avec sidebar pour les pages (protected) et (admin)
|
||||
- Middleware Next.js pour protéger les routes auth
|
||||
- Composants features (EmotionPicker, EmotionChart, TrackerTimeline)
|
||||
|
||||
### À FAIRE (bonus)
|
||||
- EncryptionService AES-256 pour chiffrer les notes en BDD
|
||||
- AuditMiddleware pour logger les actions admin
|
||||
- Page mot de passe oublié (forgot/reset password)
|
||||
- Export données utilisateur (RGPD droit d'accès)
|
||||
- Tests PHPUnit backend
|
||||
- Responsive fine-tuning mobile
|
||||
|
||||
## Structure du projet
|
||||
```
|
||||
Cesizen/
|
||||
├── backend/ # Laravel 11 API
|
||||
│ ├── app/Models/ # Eloquent : Utilisateur, Role, Tracker, SaisieTracker, Emotion, Feed, Audit, ContactUrgence
|
||||
│ ├── app/Http/Controllers/
|
||||
│ │ ├── AuthController.php
|
||||
│ │ ├── ProfilController.php
|
||||
│ │ ├── FeedController.php
|
||||
│ │ ├── EmotionController.php
|
||||
│ │ ├── SaisieTrackerController.php
|
||||
│ │ └── Admin/ # AdminUtilisateurController, AdminFeedController, AdminEmotionController
|
||||
│ ├── app/Services/ # RapportService (stats émotions)
|
||||
│ ├── app/Http/Middleware/ # JwtMiddleware, RoleMiddleware, ForceJsonResponse
|
||||
│ ├── app/Http/Requests/ # RegisterRequest, LoginRequest, StoreSaisieRequest, StoreFeedRequest, UpdateProfilRequest
|
||||
│ ├── database/migrations/ # 10 fichiers migration
|
||||
│ ├── database/seeders/ # RoleSeeder, AdminSeeder, EmotionSeeder, FeedSeeder
|
||||
│ ├── bootstrap/app.php # Configuré avec middleware alias jwt.auth + role
|
||||
│ ├── config/auth.php # Guard api/jwt, provider utilisateurs
|
||||
│ ├── config/cors.php # CORS frontend localhost:3000
|
||||
│ └── routes/api.php # Toutes les routes API v1
|
||||
├── frontend/ # Next.js 14
|
||||
│ ├── src/app/
|
||||
│ │ ├── layout.tsx # Layout racine avec Providers
|
||||
│ │ ├── page.tsx # Landing page (FAIT)
|
||||
│ │ ├── (auth)/connexion/page.tsx # FAIT
|
||||
│ │ ├── (auth)/inscription/page.tsx # FAIT
|
||||
│ │ ├── (public)/informations/ # À FAIRE
|
||||
│ │ ├── (protected)/dashboard/ # À FAIRE
|
||||
│ │ ├── (protected)/profil/ # À FAIRE
|
||||
│ │ ├── (protected)/journal/ # À FAIRE
|
||||
│ │ └── (admin)/admin/ # À FAIRE
|
||||
│ ├── src/components/
|
||||
│ │ ├── Providers.tsx # Client providers wrapper (FAIT)
|
||||
│ │ ├── ui/ # Button, Input, Card, Modal, Badge, Slider, Skeleton, ThemeToggle (FAIT)
|
||||
│ │ ├── layout/ # Header, Footer, Sidebar (FAIT)
|
||||
│ │ └── features/ # À CRÉER (EmotionPicker, EmotionChart, TrackerTimeline)
|
||||
│ ├── src/lib/
|
||||
│ │ ├── api.ts # Client Axios (FAIT)
|
||||
│ │ └── auth-store.ts # Store Zustand (FAIT)
|
||||
│ ├── src/hooks/ # useAuth, useFeeds, useTracker, useRapport, useEmotions (FAIT)
|
||||
│ └── src/types/index.ts # Interfaces TypeScript (FAIT)
|
||||
├── docker-compose.yml # PostgreSQL 16
|
||||
└── .gitignore
|
||||
```
|
||||
|
||||
## API Endpoints (préfixe `/api/v1`)
|
||||
|
||||
### Auth (public)
|
||||
- `POST /auth/register` — Inscription
|
||||
- `POST /auth/login` — Connexion (retourne JWT) — rate limited 5/min
|
||||
- `POST /auth/logout` — Déconnexion (auth)
|
||||
- `GET /auth/me` — Profil courant (auth)
|
||||
- `POST /auth/refresh` — Rafraîchir token (auth)
|
||||
|
||||
### Profil (auth membre)
|
||||
- `GET /profil` / `PUT /profil` — Lire/modifier profil
|
||||
- `PUT /profil/password` — Changer mot de passe
|
||||
- `DELETE /profil` — Supprimer compte (RGPD)
|
||||
|
||||
### Informations (public)
|
||||
- `GET /feeds` — Liste pages publiées
|
||||
- `GET /feeds/{slug}` — Détail page
|
||||
|
||||
### Tracker (auth membre)
|
||||
- `GET /tracker/saisies` — Mes saisies (filtres: date_debut, date_fin, emotion_id)
|
||||
- `POST /tracker/saisies` — Nouvelle saisie
|
||||
- `PUT /tracker/saisies/{id}` — Modifier saisie
|
||||
- `DELETE /tracker/saisies/{id}` — Supprimer saisie
|
||||
- `GET /tracker/rapports?period=week|month|quarter|year` — Rapport statistique
|
||||
|
||||
### Émotions (auth membre)
|
||||
- `GET /emotions` — Liste arborescente (niveau 1 + sous-émotions niveau 2)
|
||||
|
||||
### Admin (auth admin)
|
||||
- `GET/POST/PUT/DELETE /admin/utilisateurs` — CRUD utilisateurs
|
||||
- `PATCH /admin/utilisateurs/{id}/toggle-active` — Activer/désactiver
|
||||
- `GET/POST/PUT/DELETE /admin/feeds` — CRUD contenus
|
||||
- `GET/POST/PUT/DELETE /admin/emotions` — CRUD émotions
|
||||
|
||||
## Base de données (tables)
|
||||
1. `roles` — id, nom (visiteur/membre/administrateur), description
|
||||
2. `utilisateurs` — id, nom, prenom, email, password (bcrypt), role_id, est_actif, consentement_rgpd, soft delete
|
||||
3. `emotions` — id, nom, couleur, icone, niveau (1 ou 2), parent_id (auto-ref), est_actif
|
||||
4. `trackers` — id, utilisateur_id, nom
|
||||
5. `saisie_trackers` — id, tracker_id, emotion_id, intensite (1-10), note, date_saisie
|
||||
6. `feeds` — id, titre, slug, contenu (HTML), image_url, est_publie, auteur_id, ordre
|
||||
7. `contacts_urgence` — id, utilisateur_id, nom, telephone, relation
|
||||
8. `audits` — id, utilisateur_id, action, table_cible, anciennes_valeurs, nouvelles_valeurs, ip_address
|
||||
|
||||
## Comptes de test
|
||||
- **Admin** : admin@cesizen.fr / Admin123!
|
||||
|
||||
## Commandes utiles
|
||||
```bash
|
||||
# BDD
|
||||
docker compose up -d # Démarrer PostgreSQL
|
||||
|
||||
# Backend
|
||||
cd backend
|
||||
php artisan migrate --seed # Créer les tables et données de test
|
||||
php artisan serve # API sur localhost:8000
|
||||
|
||||
# Frontend
|
||||
cd frontend
|
||||
npm run dev # App sur localhost:3000
|
||||
```
|
||||
|
||||
## Conventions
|
||||
- Parler toujours en français dans les commits et commentaires
|
||||
- API versionnée `/api/v1/`
|
||||
- Nommage des tables/colonnes en snake_case français
|
||||
- Composants React en PascalCase
|
||||
- Routes frontend en français (connexion, inscription, journal, etc.)
|
||||
- Icônes : lucide-react
|
||||
- Notifications : react-hot-toast
|
||||
- State management : zustand (auth), @tanstack/react-query (data fetching)
|
||||
@@ -0,0 +1,4 @@
|
||||
vendor
|
||||
node_modules
|
||||
storage/logs/*.log
|
||||
.env
|
||||
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[compose.yaml]
|
||||
indent_size = 4
|
||||
@@ -0,0 +1,65 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
# PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
@@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
@@ -0,0 +1,24 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
@@ -0,0 +1,27 @@
|
||||
FROM php:8.4-cli
|
||||
|
||||
# Extensions PHP nécessaires
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
unzip \
|
||||
git \
|
||||
&& docker-php-ext-install pdo pdo_pgsql bcmath \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Dépendances PHP d'abord (cache Docker)
|
||||
COPY composer.json composer.lock ./
|
||||
RUN composer install --no-scripts --no-autoloader
|
||||
|
||||
# Copier le reste du code
|
||||
COPY . .
|
||||
RUN composer dump-autoload --optimize
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Script de démarrage : migration + seed + serve
|
||||
CMD php artisan migrate --seed --force && php artisan serve --host=0.0.0.0 --port=8000
|
||||
@@ -0,0 +1,59 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Emotion;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminEmotionController extends Controller
|
||||
{
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$emotions = Emotion::niveau(1)
|
||||
->with(['enfants' => fn($q) => $q->orderBy('nom')])
|
||||
->orderBy('nom')
|
||||
->get();
|
||||
|
||||
return response()->json($emotions);
|
||||
}
|
||||
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'nom' => 'required|string|max:255',
|
||||
'couleur' => 'required|string|max:7',
|
||||
'icone' => 'nullable|string|max:10',
|
||||
'niveau' => 'required|integer|in:1,2',
|
||||
'parent_id' => 'nullable|required_if:niveau,2|exists:emotions,id',
|
||||
]);
|
||||
|
||||
$emotion = Emotion::create($request->only('nom', 'couleur', 'icone', 'niveau', 'parent_id'));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Émotion créée',
|
||||
'emotion' => $emotion,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function update(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$emotion = Emotion::findOrFail($id);
|
||||
|
||||
$request->validate([
|
||||
'nom' => 'sometimes|string|max:255',
|
||||
'couleur' => 'sometimes|string|max:7',
|
||||
'icone' => 'nullable|string|max:10',
|
||||
'est_actif' => 'sometimes|boolean',
|
||||
]);
|
||||
|
||||
$emotion->update($request->only('nom', 'couleur', 'icone', 'est_actif'));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Émotion modifiée',
|
||||
'emotion' => $emotion,
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$emotion = Emotion::findOrFail($id);
|
||||
$emotion->update(['est_actif' => false]);
|
||||
$emotion->enfants()->update(['est_actif' => false]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Émotion désactivée',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreFeedRequest;
|
||||
use App\Models\Feed;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AdminFeedController extends Controller
|
||||
{
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$feeds = Feed::with('auteur:id,nom,prenom')
|
||||
->orderBy('ordre')
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
return response()->json($feeds);
|
||||
}
|
||||
|
||||
public function store(StoreFeedRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->validated();
|
||||
$data['auteur_id'] = auth()->id();
|
||||
$data['slug'] = $data['slug'] ?? Str::slug($data['titre']);
|
||||
|
||||
$feed = Feed::create($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Contenu créé',
|
||||
'feed' => $feed,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function update(StoreFeedRequest $request, int $id): JsonResponse
|
||||
{
|
||||
$feed = Feed::findOrFail($id);
|
||||
$data = $request->validated();
|
||||
|
||||
if (isset($data['titre']) && !isset($data['slug'])) {
|
||||
$data['slug'] = Str::slug($data['titre']);
|
||||
}
|
||||
|
||||
$feed->update($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Contenu modifié',
|
||||
'feed' => $feed,
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
Feed::findOrFail($id)->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Contenu supprimé',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Utilisateur;
|
||||
use App\Models\Role;
|
||||
use App\Models\Tracker;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminUtilisateurController extends Controller
|
||||
{
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$query = Utilisateur::with('role');
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nom', 'ilike', "%{$search}%")
|
||||
->orWhere('prenom', 'ilike', "%{$search}%")
|
||||
->orWhere('email', 'ilike', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
if ($request->filled('role')) {
|
||||
$query->whereHas('role', fn($q) => $q->where('nom', $request->role));
|
||||
}
|
||||
|
||||
$utilisateurs = $query->orderBy('created_at', 'desc')->paginate(15);
|
||||
|
||||
return response()->json($utilisateurs);
|
||||
}
|
||||
|
||||
public function show(int $id): JsonResponse
|
||||
{
|
||||
$utilisateur = Utilisateur::with('role')->findOrFail($id);
|
||||
|
||||
return response()->json($utilisateur);
|
||||
}
|
||||
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'nom' => 'required|string|max:255',
|
||||
'prenom' => 'required|string|max:255',
|
||||
'email' => 'required|email|unique:utilisateurs,email',
|
||||
'password' => 'required|string|min:8',
|
||||
'role_id' => 'required|exists:roles,id',
|
||||
]);
|
||||
|
||||
$utilisateur = Utilisateur::create($request->only('nom', 'prenom', 'email', 'password', 'role_id'));
|
||||
|
||||
Tracker::create([
|
||||
'utilisateur_id' => $utilisateur->id,
|
||||
'nom' => 'Mon journal',
|
||||
]);
|
||||
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Utilisateur créé',
|
||||
'utilisateur' => $utilisateur,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function update(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$utilisateur = Utilisateur::findOrFail($id);
|
||||
|
||||
$request->validate([
|
||||
'nom' => 'sometimes|string|max:255',
|
||||
'prenom' => 'sometimes|string|max:255',
|
||||
'email' => "sometimes|email|unique:utilisateurs,email,{$id}",
|
||||
'role_id' => 'sometimes|exists:roles,id',
|
||||
]);
|
||||
|
||||
$utilisateur->update($request->only('nom', 'prenom', 'email', 'role_id'));
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Utilisateur modifié',
|
||||
'utilisateur' => $utilisateur,
|
||||
]);
|
||||
}
|
||||
|
||||
public function toggleActive(int $id): JsonResponse
|
||||
{
|
||||
$utilisateur = Utilisateur::findOrFail($id);
|
||||
$utilisateur->update(['est_actif' => !$utilisateur->est_actif]);
|
||||
|
||||
return response()->json([
|
||||
'message' => $utilisateur->est_actif ? 'Compte activé' : 'Compte désactivé',
|
||||
'utilisateur' => $utilisateur,
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$utilisateur = Utilisateur::findOrFail($id);
|
||||
$utilisateur->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Utilisateur supprimé',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\RegisterRequest;
|
||||
use App\Http\Requests\LoginRequest;
|
||||
use App\Models\Utilisateur;
|
||||
use App\Models\Role;
|
||||
use App\Models\Tracker;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Tymon\JWTAuth\Facades\JWTAuth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function register(RegisterRequest $request): JsonResponse
|
||||
{
|
||||
$role = Role::where('nom', 'membre')->first();
|
||||
|
||||
$utilisateur = Utilisateur::create([
|
||||
'nom' => $request->nom,
|
||||
'prenom' => $request->prenom,
|
||||
'email' => $request->email,
|
||||
'password' => $request->password,
|
||||
'role_id' => $role->id,
|
||||
'consentement_rgpd' => true,
|
||||
]);
|
||||
|
||||
Tracker::create([
|
||||
'utilisateur_id' => $utilisateur->id,
|
||||
'nom' => 'Mon journal',
|
||||
]);
|
||||
|
||||
$token = JWTAuth::fromUser($utilisateur);
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Inscription réussie',
|
||||
'utilisateur' => $utilisateur,
|
||||
'token' => $token,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function login(LoginRequest $request): JsonResponse
|
||||
{
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if (!$token = auth()->attempt($credentials)) {
|
||||
return response()->json([
|
||||
'message' => 'Identifiants incorrects',
|
||||
], 401);
|
||||
}
|
||||
|
||||
$utilisateur = auth()->user();
|
||||
|
||||
if (!$utilisateur->est_actif) {
|
||||
auth()->logout();
|
||||
return response()->json([
|
||||
'message' => 'Votre compte a été désactivé',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'utilisateur' => $utilisateur,
|
||||
'token' => $token,
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout(): JsonResponse
|
||||
{
|
||||
auth()->logout();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Déconnexion réussie',
|
||||
]);
|
||||
}
|
||||
|
||||
public function me(): JsonResponse
|
||||
{
|
||||
$utilisateur = auth()->user();
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json($utilisateur);
|
||||
}
|
||||
|
||||
public function refresh(): JsonResponse
|
||||
{
|
||||
$token = auth()->refresh();
|
||||
$utilisateur = auth()->user();
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'utilisateur' => $utilisateur,
|
||||
'token' => $token,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Feed;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class FeedController extends Controller
|
||||
{
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$feeds = Feed::publie()
|
||||
->orderBy('ordre')
|
||||
->orderBy('created_at', 'desc')
|
||||
->get(['id', 'titre', 'slug', 'contenu', 'image_url', 'ordre', 'created_at']);
|
||||
|
||||
return response()->json($feeds);
|
||||
}
|
||||
|
||||
public function show(string $slug): JsonResponse
|
||||
{
|
||||
$feed = Feed::publie()->where('slug', $slug)->with('auteur:id,nom,prenom')->firstOrFail();
|
||||
|
||||
return response()->json($feed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\UpdateProfilRequest;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class ProfilController extends Controller
|
||||
{
|
||||
public function show(): JsonResponse
|
||||
{
|
||||
$utilisateur = auth()->user();
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json($utilisateur);
|
||||
}
|
||||
|
||||
public function update(UpdateProfilRequest $request): JsonResponse
|
||||
{
|
||||
$utilisateur = auth()->user();
|
||||
$utilisateur->update($request->validated());
|
||||
$utilisateur->load('role');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Profil mis à jour',
|
||||
'utilisateur' => $utilisateur,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updatePassword(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'ancien_mot_de_passe' => 'required|string',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
|
||||
$utilisateur = auth()->user();
|
||||
|
||||
if (!Hash::check($request->ancien_mot_de_passe, $utilisateur->password)) {
|
||||
return response()->json([
|
||||
'message' => 'L\'ancien mot de passe est incorrect',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$utilisateur->update(['password' => $request->password]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Mot de passe modifié avec succès',
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(): JsonResponse
|
||||
{
|
||||
$utilisateur = auth()->user();
|
||||
$utilisateur->delete();
|
||||
auth()->logout();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Compte supprimé avec succès',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\StoreSaisieRequest;
|
||||
use App\Models\SaisieTracker;
|
||||
use App\Services\RapportService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SaisieTrackerController extends Controller
|
||||
{
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$tracker = auth()->user()->tracker;
|
||||
|
||||
if (!$tracker) {
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
$query = $tracker->saisies()->with('emotion')->orderBy('date_saisie', 'desc');
|
||||
|
||||
if ($request->filled('date_debut')) {
|
||||
$query->where('date_saisie', '>=', $request->date_debut);
|
||||
}
|
||||
if ($request->filled('date_fin')) {
|
||||
$query->where('date_saisie', '<=', $request->date_fin);
|
||||
}
|
||||
if ($request->filled('emotion_id')) {
|
||||
$query->where('emotion_id', $request->emotion_id);
|
||||
}
|
||||
|
||||
$saisies = $query->paginate(20);
|
||||
|
||||
return response()->json($saisies);
|
||||
}
|
||||
|
||||
public function store(StoreSaisieRequest $request): JsonResponse
|
||||
{
|
||||
$tracker = auth()->user()->tracker;
|
||||
|
||||
if (!$tracker) {
|
||||
$tracker = auth()->user()->tracker()->create(['nom' => 'Mon journal']);
|
||||
}
|
||||
|
||||
$saisie = $tracker->saisies()->create($request->validated());
|
||||
$saisie->load('emotion');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Saisie enregistrée',
|
||||
'saisie' => $saisie,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function update(StoreSaisieRequest $request, int $id): JsonResponse
|
||||
{
|
||||
$saisie = auth()->user()->tracker->saisies()->findOrFail($id);
|
||||
$saisie->update($request->validated());
|
||||
$saisie->load('emotion');
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Saisie modifiée',
|
||||
'saisie' => $saisie,
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$saisie = auth()->user()->tracker->saisies()->findOrFail($id);
|
||||
$saisie->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Saisie supprimée',
|
||||
]);
|
||||
}
|
||||
|
||||
public function rapports(Request $request, RapportService $rapportService): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'period' => 'sometimes|in:week,month,quarter,year',
|
||||
]);
|
||||
|
||||
$period = $request->get('period', 'month');
|
||||
$rapport = $rapportService->genererRapport(auth()->user(), $period);
|
||||
|
||||
return response()->json($rapport);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ForceJsonResponse
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$request->headers->set('Accept', 'application/json');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Tymon\JWTAuth\Facades\JWTAuth;
|
||||
use Tymon\JWTAuth\Exceptions\TokenExpiredException;
|
||||
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
|
||||
class JwtMiddleware
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
try {
|
||||
JWTAuth::parseToken()->authenticate();
|
||||
} catch (TokenExpiredException $e) {
|
||||
return response()->json(['message' => 'Token expiré'], 401);
|
||||
} catch (TokenInvalidException $e) {
|
||||
return response()->json(['message' => 'Token invalide'], 401);
|
||||
} catch (JWTException $e) {
|
||||
return response()->json(['message' => 'Token absent'], 401);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoleMiddleware
|
||||
{
|
||||
public function handle(Request $request, Closure $next, string ...$roles)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if (!$user || !in_array($user->role->nom, $roles)) {
|
||||
return response()->json(['message' => 'Accès non autorisé'], 403);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'email.required' => 'L\'adresse email est obligatoire.',
|
||||
'email.email' => 'L\'adresse email n\'est pas valide.',
|
||||
'password.required' => 'Le mot de passe est obligatoire.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RegisterRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nom' => 'required|string|max:255',
|
||||
'prenom' => 'required|string|max:255',
|
||||
'email' => 'required|email|unique:utilisateurs,email',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
'consentement_rgpd' => 'required|accepted',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'nom.required' => 'Le nom est obligatoire.',
|
||||
'prenom.required' => 'Le prénom est obligatoire.',
|
||||
'email.required' => 'L\'adresse email est obligatoire.',
|
||||
'email.email' => 'L\'adresse email n\'est pas valide.',
|
||||
'email.unique' => 'Cette adresse email est déjà utilisée.',
|
||||
'password.required' => 'Le mot de passe est obligatoire.',
|
||||
'password.min' => 'Le mot de passe doit contenir au moins 8 caractères.',
|
||||
'password.confirmed' => 'La confirmation du mot de passe ne correspond pas.',
|
||||
'consentement_rgpd.required' => 'Vous devez accepter le traitement de vos données.',
|
||||
'consentement_rgpd.accepted' => 'Vous devez accepter le traitement de vos données.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateProfilRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nom' => 'sometimes|string|max:255',
|
||||
'prenom' => 'sometimes|string|max:255',
|
||||
'email' => [
|
||||
'sometimes',
|
||||
'email',
|
||||
Rule::unique('utilisateurs', 'email')->ignore(auth()->id()),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Audit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'audits';
|
||||
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
protected $fillable = [
|
||||
'utilisateur_id',
|
||||
'action',
|
||||
'table_cible',
|
||||
'enregistrement_id',
|
||||
'anciennes_valeurs',
|
||||
'nouvelles_valeurs',
|
||||
'ip_address',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'anciennes_valeurs' => 'array',
|
||||
'nouvelles_valeurs' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function utilisateur(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Utilisateur::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ContactUrgence extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'contacts_urgence';
|
||||
|
||||
protected $fillable = [
|
||||
'utilisateur_id',
|
||||
'nom',
|
||||
'telephone',
|
||||
'relation',
|
||||
];
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function utilisateur(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Utilisateur::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Emotion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'emotions';
|
||||
|
||||
protected $fillable = [
|
||||
'nom',
|
||||
'couleur',
|
||||
'icone',
|
||||
'niveau',
|
||||
'parent_id',
|
||||
'est_actif',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'niveau' => 'integer',
|
||||
'est_actif' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Emotion::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function enfants(): HasMany
|
||||
{
|
||||
return $this->hasMany(Emotion::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function saisieTrackers(): HasMany
|
||||
{
|
||||
return $this->hasMany(SaisieTracker::class);
|
||||
}
|
||||
|
||||
// ──── Scopes ────
|
||||
|
||||
public function scopeActives(Builder $query): Builder
|
||||
{
|
||||
return $query->where('est_actif', true);
|
||||
}
|
||||
|
||||
public function scopeNiveau(Builder $query, int $niveau): Builder
|
||||
{
|
||||
return $query->where('niveau', $niveau);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Feed extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'feeds';
|
||||
|
||||
protected $fillable = [
|
||||
'titre',
|
||||
'slug',
|
||||
'contenu',
|
||||
'image_url',
|
||||
'est_publie',
|
||||
'auteur_id',
|
||||
'ordre',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'est_publie' => 'boolean',
|
||||
'ordre' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function auteur(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Utilisateur::class, 'auteur_id');
|
||||
}
|
||||
|
||||
// ──── Scopes ────
|
||||
|
||||
public function scopePublie(Builder $query): Builder
|
||||
{
|
||||
return $query->where('est_publie', true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'roles';
|
||||
|
||||
protected $fillable = [
|
||||
'nom',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function utilisateurs(): HasMany
|
||||
{
|
||||
return $this->hasMany(Utilisateur::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SaisieTracker extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'saisie_trackers';
|
||||
|
||||
protected $fillable = [
|
||||
'tracker_id',
|
||||
'emotion_id',
|
||||
'intensite',
|
||||
'note',
|
||||
'date_saisie',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'date_saisie' => 'datetime',
|
||||
'intensite' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function tracker(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tracker::class);
|
||||
}
|
||||
|
||||
public function emotion(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Emotion::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Tracker extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'trackers';
|
||||
|
||||
protected $fillable = [
|
||||
'utilisateur_id',
|
||||
'nom',
|
||||
];
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function utilisateur(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Utilisateur::class);
|
||||
}
|
||||
|
||||
public function saisies(): HasMany
|
||||
{
|
||||
return $this->hasMany(SaisieTracker::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
|
||||
class Utilisateur extends Authenticatable implements JWTSubject
|
||||
{
|
||||
use HasFactory, Notifiable, SoftDeletes;
|
||||
|
||||
protected $table = 'utilisateurs';
|
||||
|
||||
protected $fillable = [
|
||||
'nom',
|
||||
'prenom',
|
||||
'email',
|
||||
'password',
|
||||
'role_id',
|
||||
'est_actif',
|
||||
'consentement_rgpd',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'est_actif' => 'boolean',
|
||||
'consentement_rgpd' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// ──── JWTSubject ────
|
||||
|
||||
public function getJWTIdentifier(): mixed
|
||||
{
|
||||
return $this->getKey();
|
||||
}
|
||||
|
||||
public function getJWTCustomClaims(): array
|
||||
{
|
||||
return [
|
||||
'role' => $this->role->nom,
|
||||
];
|
||||
}
|
||||
|
||||
// ──── Relations ────
|
||||
|
||||
public function role(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function tracker(): HasOne
|
||||
{
|
||||
return $this->hasOne(Tracker::class);
|
||||
}
|
||||
|
||||
public function contactsUrgence(): HasMany
|
||||
{
|
||||
return $this->hasMany(ContactUrgence::class);
|
||||
}
|
||||
|
||||
// ──── Helpers ────
|
||||
|
||||
public function estAdmin(): bool
|
||||
{
|
||||
return $this->role->nom === 'administrateur';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Utilisateur;
|
||||
use App\Models\SaisieTracker;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RapportService
|
||||
{
|
||||
public function genererRapport(Utilisateur $user, string $period): array
|
||||
{
|
||||
$tracker = $user->tracker;
|
||||
|
||||
if (!$tracker) {
|
||||
return $this->rapportVide();
|
||||
}
|
||||
|
||||
$dateDebut = $this->getDateDebut($period);
|
||||
$dateFin = Carbon::now();
|
||||
|
||||
$saisies = $tracker->saisies()
|
||||
->with('emotion')
|
||||
->where('date_saisie', '>=', $dateDebut)
|
||||
->where('date_saisie', '<=', $dateFin)
|
||||
->orderBy('date_saisie')
|
||||
->get();
|
||||
|
||||
if ($saisies->isEmpty()) {
|
||||
return $this->rapportVide();
|
||||
}
|
||||
|
||||
$totalSaisies = $saisies->count();
|
||||
$intensiteMoyenne = round($saisies->avg('intensite'), 1);
|
||||
|
||||
$emotionsDominantes = $saisies->groupBy('emotion_id')
|
||||
->map(fn($group) => [
|
||||
'emotion' => $group->first()->emotion,
|
||||
'count' => $group->count(),
|
||||
'intensite_moyenne' => round($group->avg('intensite'), 1),
|
||||
])
|
||||
->sortByDesc('count')
|
||||
->values();
|
||||
|
||||
$emotionDominante = $emotionsDominantes->first();
|
||||
|
||||
$evolution = $this->getEvolution($saisies, $period, $dateDebut, $dateFin);
|
||||
|
||||
$repartition = $emotionsDominantes->map(fn($item) => [
|
||||
'nom' => $item['emotion']->nom,
|
||||
'couleur' => $item['emotion']->couleur,
|
||||
'icone' => $item['emotion']->icone,
|
||||
'count' => $item['count'],
|
||||
'pourcentage' => round(($item['count'] / $totalSaisies) * 100, 1),
|
||||
'intensite_moyenne' => $item['intensite_moyenne'],
|
||||
])->values();
|
||||
|
||||
return [
|
||||
'periode' => $period,
|
||||
'date_debut' => $dateDebut->toDateString(),
|
||||
'date_fin' => $dateFin->toDateString(),
|
||||
'stats' => [
|
||||
'total_saisies' => $totalSaisies,
|
||||
'intensite_moyenne' => $intensiteMoyenne,
|
||||
'emotion_dominante' => $emotionDominante ? [
|
||||
'nom' => $emotionDominante['emotion']->nom,
|
||||
'couleur' => $emotionDominante['emotion']->couleur,
|
||||
'icone' => $emotionDominante['emotion']->icone,
|
||||
'count' => $emotionDominante['count'],
|
||||
] : null,
|
||||
],
|
||||
'repartition' => $repartition,
|
||||
'evolution' => $evolution,
|
||||
];
|
||||
}
|
||||
|
||||
private function getDateDebut(string $period): Carbon
|
||||
{
|
||||
return match ($period) {
|
||||
'week' => Carbon::now()->subWeek(),
|
||||
'month' => Carbon::now()->subMonth(),
|
||||
'quarter' => Carbon::now()->subMonths(3),
|
||||
'year' => Carbon::now()->subYear(),
|
||||
default => Carbon::now()->subMonth(),
|
||||
};
|
||||
}
|
||||
|
||||
private function getEvolution($saisies, string $period, Carbon $dateDebut, Carbon $dateFin): array
|
||||
{
|
||||
$format = match ($period) {
|
||||
'week' => 'Y-m-d',
|
||||
'month' => 'Y-m-d',
|
||||
'quarter' => 'Y-W',
|
||||
'year' => 'Y-m',
|
||||
default => 'Y-m-d',
|
||||
};
|
||||
|
||||
$grouped = $saisies->groupBy(fn($saisie) => $saisie->date_saisie->format($format));
|
||||
|
||||
$labels = [];
|
||||
$dataIntensiteMoyenne = [];
|
||||
|
||||
foreach ($grouped as $label => $group) {
|
||||
$labels[] = $label;
|
||||
$dataIntensiteMoyenne[] = round($group->avg('intensite'), 1);
|
||||
}
|
||||
|
||||
$emotionDatasets = $saisies->groupBy('emotion_id')->map(function ($emotionGroup) use ($format, $grouped) {
|
||||
$emotion = $emotionGroup->first()->emotion;
|
||||
$byPeriod = $emotionGroup->groupBy(fn($s) => $s->date_saisie->format($format));
|
||||
|
||||
$data = [];
|
||||
foreach ($grouped->keys() as $label) {
|
||||
$data[] = isset($byPeriod[$label]) ? $byPeriod[$label]->count() : 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'nom' => $emotion->nom,
|
||||
'couleur' => $emotion->couleur,
|
||||
'data' => $data,
|
||||
];
|
||||
})->values();
|
||||
|
||||
return [
|
||||
'labels' => $labels,
|
||||
'intensite_moyenne' => $dataIntensiteMoyenne,
|
||||
'emotions' => $emotionDatasets,
|
||||
];
|
||||
}
|
||||
|
||||
private function rapportVide(): array
|
||||
{
|
||||
return [
|
||||
'periode' => 'month',
|
||||
'date_debut' => Carbon::now()->subMonth()->toDateString(),
|
||||
'date_fin' => Carbon::now()->toDateString(),
|
||||
'stats' => [
|
||||
'total_saisies' => 0,
|
||||
'intensite_moyenne' => 0,
|
||||
'emotion_dominante' => null,
|
||||
],
|
||||
'repartition' => [],
|
||||
'evolution' => [
|
||||
'labels' => [],
|
||||
'intensite_moyenne' => [],
|
||||
'emotions' => [],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
api: __DIR__.'/../routes/api.php',
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
$middleware->alias([
|
||||
'jwt.auth' => \App\Http\Middleware\JwtMiddleware::class,
|
||||
'role' => \App\Http\Middleware\RoleMiddleware::class,
|
||||
]);
|
||||
|
||||
$middleware->api(prepend: [
|
||||
\App\Http\Middleware\ForceJsonResponse::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
})->create();
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Providers\AppServiceProvider;
|
||||
|
||||
return [
|
||||
AppServiceProvider::class,
|
||||
];
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1",
|
||||
"tymon/jwt-auth": "^2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.24",
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.50"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"setup": [
|
||||
"composer install",
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan key:generate",
|
||||
"@php artisan migrate --force",
|
||||
"npm install",
|
||||
"npm run build"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"pre-package-uninstall": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
Generated
+8540
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Utilisateur;
|
||||
|
||||
return [
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'api',
|
||||
'passwords' => 'utilisateurs',
|
||||
],
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'utilisateurs',
|
||||
],
|
||||
'api' => [
|
||||
'driver' => 'jwt',
|
||||
'provider' => 'utilisateurs',
|
||||
],
|
||||
],
|
||||
|
||||
'providers' => [
|
||||
'utilisateurs' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => Utilisateur::class,
|
||||
],
|
||||
],
|
||||
|
||||
'passwords' => [
|
||||
'utilisateurs' => [
|
||||
'provider' => 'utilisateurs',
|
||||
'table' => 'password_reset_tokens',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane",
|
||||
| "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'stores' => [
|
||||
'database',
|
||||
'array',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => [env('FRONTEND_URL', 'http://localhost:3000')],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 3600,
|
||||
|
||||
'supports_credentials' => true,
|
||||
|
||||
];
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pdo\Mysql;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
'transaction_mode' => 'DEFERRED',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => env('DB_SSLMODE', 'prefer'),
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||
'persistent' => env('REDIS_PERSISTENT', false),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/private'),
|
||||
'serve' => true,
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'handler_with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => env('MAIL_SCHEME'),
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
|
||||
| "deferred", "background", "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'deferred' => [
|
||||
'driver' => 'deferred',
|
||||
],
|
||||
|
||||
'background' => [
|
||||
'driver' => 'background',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'connections' => [
|
||||
'database',
|
||||
'deferred',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'key' => env('POSTMARK_API_KEY'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_API_KEY'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "memcached",
|
||||
| "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain without subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nom')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('utilisateurs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nom');
|
||||
$table->string('prenom');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->foreignId('role_id')->constrained('roles');
|
||||
$table->boolean('est_actif')->default(true);
|
||||
$table->boolean('consentement_rgpd')->default(false);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('utilisateurs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('emotions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nom');
|
||||
$table->string('couleur', 7);
|
||||
$table->string('icone')->nullable();
|
||||
$table->tinyInteger('niveau');
|
||||
$table->foreignId('parent_id')->nullable()->constrained('emotions');
|
||||
$table->boolean('est_actif')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('emotions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('trackers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('utilisateur_id')->constrained('utilisateurs')->onDelete('cascade');
|
||||
$table->string('nom')->default('Mon journal');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('trackers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('saisie_trackers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tracker_id')->constrained('trackers')->onDelete('cascade');
|
||||
$table->foreignId('emotion_id')->constrained('emotions');
|
||||
$table->tinyInteger('intensite');
|
||||
$table->text('note')->nullable();
|
||||
$table->dateTime('date_saisie');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('saisie_trackers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('feeds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('titre');
|
||||
$table->string('slug')->unique();
|
||||
$table->longText('contenu');
|
||||
$table->string('image_url')->nullable();
|
||||
$table->boolean('est_publie')->default(false);
|
||||
$table->foreignId('auteur_id')->constrained('utilisateurs');
|
||||
$table->integer('ordre')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('feeds');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contacts_urgence', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('utilisateur_id')->constrained('utilisateurs')->onDelete('cascade');
|
||||
$table->string('nom');
|
||||
$table->string('telephone');
|
||||
$table->string('relation');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contacts_urgence');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('audits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('utilisateur_id')->nullable()->constrained('utilisateurs');
|
||||
$table->string('action');
|
||||
$table->string('table_cible');
|
||||
$table->unsignedBigInteger('enregistrement_id')->nullable();
|
||||
$table->json('anciennes_valeurs')->nullable();
|
||||
$table->json('nouvelles_valeurs')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('audits');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\Utilisateur;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Créer le compte administrateur par défaut.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$roleAdmin = Role::where('nom', 'administrateur')->firstOrFail();
|
||||
|
||||
Utilisateur::firstOrCreate(
|
||||
['email' => 'admin@cesizen.fr'],
|
||||
[
|
||||
'nom' => 'Admin',
|
||||
'prenom' => 'CESIZen',
|
||||
'email' => 'admin@cesizen.fr',
|
||||
'password' => Hash::make('Admin123!'),
|
||||
'role_id' => $roleAdmin->id,
|
||||
'est_actif' => true,
|
||||
'consentement_rgpd' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
RoleSeeder::class,
|
||||
AdminSeeder::class,
|
||||
EmotionSeeder::class,
|
||||
FeedSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class EmotionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Insérer les émotions de niveau 1 et leurs sous-émotions de niveau 2.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$emotions = [
|
||||
[
|
||||
'nom' => 'Joie',
|
||||
'couleur' => '#FFD700',
|
||||
'icone' => '😊',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Bonheur', 'couleur' => '#FFE44D'],
|
||||
['nom' => 'Gratitude', 'couleur' => '#FFEB70'],
|
||||
['nom' => 'Sérénité', 'couleur' => '#FFF0A0'],
|
||||
['nom' => 'Enthousiasme', 'couleur' => '#FFE333'],
|
||||
['nom' => 'Fierté', 'couleur' => '#FFED80'],
|
||||
['nom' => 'Espoir', 'couleur' => '#FFF4B3'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Tristesse',
|
||||
'couleur' => '#4169E1',
|
||||
'icone' => '😢',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Mélancolie', 'couleur' => '#6A8BE9'],
|
||||
['nom' => 'Solitude', 'couleur' => '#7D9BED'],
|
||||
['nom' => 'Déception', 'couleur' => '#90ABF1'],
|
||||
['nom' => 'Nostalgie', 'couleur' => '#A3BBF5'],
|
||||
['nom' => 'Chagrin', 'couleur' => '#5A7DE5'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Colère',
|
||||
'couleur' => '#DC143C',
|
||||
'icone' => '😠',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Frustration', 'couleur' => '#E34363'],
|
||||
['nom' => 'Irritation', 'couleur' => '#E9637F'],
|
||||
['nom' => 'Agacement', 'couleur' => '#EF839B'],
|
||||
['nom' => 'Rage', 'couleur' => '#E23355'],
|
||||
['nom' => 'Indignation', 'couleur' => '#E85373'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Peur',
|
||||
'couleur' => '#9932CC',
|
||||
'icone' => '😰',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Anxiété', 'couleur' => '#AD5BD6'],
|
||||
['nom' => 'Inquiétude', 'couleur' => '#B96FDC'],
|
||||
['nom' => 'Panique', 'couleur' => '#C583E2'],
|
||||
['nom' => 'Stress', 'couleur' => '#D197E8'],
|
||||
['nom' => 'Appréhension', 'couleur' => '#DDABEE'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Dégoût',
|
||||
'couleur' => '#228B22',
|
||||
'icone' => '🤢',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Aversion', 'couleur' => '#4DA64D'],
|
||||
['nom' => 'Répulsion', 'couleur' => '#66B366'],
|
||||
['nom' => 'Mépris', 'couleur' => '#80C080'],
|
||||
['nom' => 'Écœurement', 'couleur' => '#3D9C3D'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Surprise',
|
||||
'couleur' => '#FF8C00',
|
||||
'icone' => '😲',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Étonnement', 'couleur' => '#FFA333'],
|
||||
['nom' => 'Stupéfaction', 'couleur' => '#FFB666'],
|
||||
['nom' => 'Émerveillement', 'couleur' => '#FFC999'],
|
||||
['nom' => 'Choc', 'couleur' => '#FF9A1A'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'nom' => 'Amour',
|
||||
'couleur' => '#FF69B4',
|
||||
'icone' => '💕',
|
||||
'sous_emotions' => [
|
||||
['nom' => 'Tendresse', 'couleur' => '#FF87C3'],
|
||||
['nom' => 'Affection', 'couleur' => '#FFA5D2'],
|
||||
['nom' => 'Compassion', 'couleur' => '#FFC3E1'],
|
||||
['nom' => 'Admiration', 'couleur' => '#FF96CA'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$now = now();
|
||||
|
||||
foreach ($emotions as $emotionData) {
|
||||
// Insérer l'émotion de niveau 1
|
||||
$parentId = DB::table('emotions')->insertGetId([
|
||||
'nom' => $emotionData['nom'],
|
||||
'couleur' => $emotionData['couleur'],
|
||||
'icone' => $emotionData['icone'],
|
||||
'niveau' => 1,
|
||||
'parent_id' => null,
|
||||
'est_actif' => true,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
// Insérer les sous-émotions de niveau 2
|
||||
foreach ($emotionData['sous_emotions'] as $sousEmotion) {
|
||||
DB::table('emotions')->insert([
|
||||
'nom' => $sousEmotion['nom'],
|
||||
'couleur' => $sousEmotion['couleur'],
|
||||
'icone' => $emotionData['icone'],
|
||||
'niveau' => 2,
|
||||
'parent_id' => $parentId,
|
||||
'est_actif' => true,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FeedSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Créer les pages de contenu par défaut.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$now = now();
|
||||
|
||||
$feeds = [
|
||||
[
|
||||
'titre' => 'Bienvenue sur CESIZen',
|
||||
'slug' => 'bienvenue',
|
||||
'contenu' => '<h2>Bienvenue sur CESIZen, votre compagnon de bien-être</h2>
|
||||
<p>CESIZen est une plateforme dédiée à la gestion du stress et au suivi émotionnel, développée en partenariat avec le Ministère des Solidarités et de la Santé. Notre mission est de vous accompagner au quotidien dans la compréhension et la gestion de vos émotions.</p>
|
||||
<p>Grâce à notre <strong>tracker d\'émotions</strong>, vous pouvez enregistrer vos ressentis tout au long de la journée, suivre leur évolution dans le temps et mieux comprendre les situations qui influencent votre état émotionnel. Chaque saisie est confidentielle et sécurisée.</p>
|
||||
<p>Explorez nos articles dans la rubrique <strong>Informations</strong> pour découvrir des ressources sur la santé mentale, des techniques de relaxation et des conseils pratiques pour améliorer votre bien-être au quotidien. N\'hésitez pas à créer votre compte pour profiter de toutes les fonctionnalités de la plateforme.</p>',
|
||||
'image_url' => null,
|
||||
'est_publie' => true,
|
||||
'auteur_id' => 1,
|
||||
'ordre' => 1,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'titre' => 'Comprendre le stress',
|
||||
'slug' => 'comprendre-le-stress',
|
||||
'contenu' => '<h2>Qu\'est-ce que le stress ?</h2>
|
||||
<p>Le stress est une réaction naturelle de l\'organisme face à une situation perçue comme menaçante ou exigeante. Il mobilise nos ressources physiques et mentales pour faire face aux défis du quotidien. À court terme, le stress peut être bénéfique : il nous aide à rester concentrés, à réagir rapidement et à nous adapter. On parle alors de <strong>stress positif</strong> ou <em>eustress</em>.</p>
|
||||
<p>Cependant, lorsque le stress devient chronique, il peut avoir des conséquences néfastes sur notre santé. Un stress prolongé peut entraîner des troubles du sommeil, des maux de tête, des tensions musculaires, une baisse de l\'immunité, et favoriser l\'apparition de troubles anxieux ou dépressifs. Il est donc essentiel d\'apprendre à reconnaître les signes d\'un stress excessif.</p>
|
||||
<h3>Les principaux facteurs de stress</h3>
|
||||
<p>Les sources de stress sont multiples et varient d\'une personne à l\'autre. Parmi les plus courantes, on retrouve : la <strong>charge de travail</strong> excessive, les <strong>conflits interpersonnels</strong>, les <strong>changements de vie</strong> importants (déménagement, séparation, nouveau poste), les <strong>difficultés financières</strong> et l\'<strong>incertitude</strong> face à l\'avenir. Identifier vos propres déclencheurs est la première étape pour mieux gérer votre stress.</p>
|
||||
<p>Le tracker d\'émotions de CESIZen peut vous aider à repérer les moments et les situations où votre niveau de stress augmente. En enregistrant régulièrement vos ressentis, vous pourrez identifier des schémas récurrents et mettre en place des stratégies adaptées.</p>',
|
||||
'image_url' => null,
|
||||
'est_publie' => true,
|
||||
'auteur_id' => 1,
|
||||
'ordre' => 2,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'titre' => 'Techniques de relaxation',
|
||||
'slug' => 'techniques-relaxation',
|
||||
'contenu' => '<h2>Des outils simples pour retrouver le calme</h2>
|
||||
<p>La relaxation est un ensemble de techniques qui permettent de réduire les tensions physiques et mentales liées au stress. Pratiquées régulièrement, elles contribuent à améliorer la qualité de vie, le sommeil et la concentration. Voici quelques méthodes accessibles à tous.</p>
|
||||
<h3>La respiration profonde</h3>
|
||||
<p>La technique de respiration 4-7-8 est l\'une des plus efficaces pour calmer rapidement le système nerveux. Inspirez par le nez pendant <strong>4 secondes</strong>, retenez votre souffle pendant <strong>7 secondes</strong>, puis expirez lentement par la bouche pendant <strong>8 secondes</strong>. Répétez ce cycle 3 à 4 fois. Cette méthode active le système nerveux parasympathique et favorise un état de détente profonde.</p>
|
||||
<h3>La cohérence cardiaque</h3>
|
||||
<p>La cohérence cardiaque consiste à adopter un rythme respiratoire régulier de <strong>6 respirations par minute</strong> pendant 5 minutes. Inspirez pendant 5 secondes, expirez pendant 5 secondes. Pratiquée 3 fois par jour (matin, midi et soir), cette technique a des effets prouvés sur la réduction du cortisol, l\'hormone du stress.</p>
|
||||
<h3>La méditation de pleine conscience</h3>
|
||||
<p>La pleine conscience, ou <em>mindfulness</em>, consiste à porter son attention sur le moment présent, sans jugement. Asseyez-vous confortablement, fermez les yeux et concentrez-vous sur vos sensations corporelles, votre respiration ou les sons qui vous entourent. Même 5 minutes par jour peuvent faire une différence significative sur votre niveau de stress et votre bien-être général.</p>',
|
||||
'image_url' => null,
|
||||
'est_publie' => true,
|
||||
'auteur_id' => 1,
|
||||
'ordre' => 3,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'titre' => 'Quand consulter un professionnel',
|
||||
'slug' => 'quand-consulter',
|
||||
'contenu' => '<h2>Reconnaître les signes qui doivent alerter</h2>
|
||||
<p>Il est tout à fait normal de traverser des périodes de stress ou de tristesse. Cependant, certains signes indiquent qu\'il est temps de solliciter l\'aide d\'un professionnel de santé mentale. Reconnaître ces signaux est un acte de courage, pas de faiblesse.</p>
|
||||
<h3>Les signes à surveiller</h3>
|
||||
<p>Consultez un professionnel si vous observez un ou plusieurs de ces symptômes de manière persistante (plus de deux semaines) : <strong>troubles du sommeil</strong> importants (insomnie ou hypersomnie), <strong>perte d\'intérêt</strong> pour les activités que vous aimiez, <strong>difficultés de concentration</strong>, <strong>irritabilité</strong> inhabituelle, <strong>fatigue</strong> constante malgré le repos, <strong>isolement social</strong>, ou des <strong>pensées négatives</strong> récurrentes.</p>
|
||||
<h3>Vers qui se tourner ?</h3>
|
||||
<p>Plusieurs professionnels peuvent vous accompagner. Votre <strong>médecin traitant</strong> est souvent le premier interlocuteur : il peut évaluer votre situation et vous orienter. Les <strong>psychologues</strong> proposent un accompagnement par la parole, tandis que les <strong>psychiatres</strong>, médecins spécialisés, peuvent prescrire un traitement médicamenteux si nécessaire. N\'hésitez pas non plus à contacter les <strong>lignes d\'écoute</strong> gratuites et anonymes en cas de besoin urgent.</p>
|
||||
<p><strong>Numéros utiles :</strong> SOS Amitié (09 72 39 40 50), Fil Santé Jeunes (0 800 235 236), Numéro national de prévention du suicide (3114). Ces services sont disponibles 24h/24 et 7j/7.</p>',
|
||||
'image_url' => null,
|
||||
'est_publie' => true,
|
||||
'auteur_id' => 1,
|
||||
'ordre' => 4,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($feeds as $feed) {
|
||||
DB::table('feeds')->updateOrInsert(
|
||||
['slug' => $feed['slug']],
|
||||
$feed
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Role;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Insérer les rôles par défaut.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$roles = [
|
||||
[
|
||||
'nom' => 'visiteur',
|
||||
'description' => 'Visiteur anonyme du site',
|
||||
],
|
||||
[
|
||||
'nom' => 'membre',
|
||||
'description' => 'Utilisateur inscrit et connecté',
|
||||
],
|
||||
[
|
||||
'nom' => 'administrateur',
|
||||
'description' => 'Administrateur de la plateforme',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($roles as $role) {
|
||||
Role::firstOrCreate(['nom' => $role['nom']], $role);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://www.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"dev": "vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"axios": "^1.11.0",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^2.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "^7.0.7"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="BROADCAST_CONNECTION" value="null"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="DB_URL" value=""/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,25 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Handle X-XSRF-Token Header
|
||||
RewriteCond %{HTTP:x-xsrf-token} .
|
||||
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Determine if the application is in maintenance mode...
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->handleRequest(Request::capture());
|
||||
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,11 @@
|
||||
@import 'tailwindcss';
|
||||
|
||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||
@source '../../storage/framework/views/*.php';
|
||||
@source '../**/*.blade.php';
|
||||
@source '../**/*.js';
|
||||
|
||||
@theme {
|
||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
import './bootstrap';
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\ProfilController;
|
||||
use App\Http\Controllers\FeedController;
|
||||
use App\Http\Controllers\EmotionController;
|
||||
use App\Http\Controllers\SaisieTrackerController;
|
||||
use App\Http\Controllers\Admin\AdminUtilisateurController;
|
||||
use App\Http\Controllers\Admin\AdminFeedController;
|
||||
use App\Http\Controllers\Admin\AdminEmotionController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes — CESIZen v1
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Route::prefix('v1')->group(function () {
|
||||
|
||||
// ── Auth (public) ──────────────────────────────────────
|
||||
Route::prefix('auth')->group(function () {
|
||||
Route::post('register', [AuthController::class, 'register']);
|
||||
Route::post('login', [AuthController::class, 'login'])
|
||||
->middleware('throttle:5,1');
|
||||
|
||||
Route::middleware('jwt.auth')->group(function () {
|
||||
Route::post('logout', [AuthController::class, 'logout']);
|
||||
Route::get('me', [AuthController::class, 'me']);
|
||||
Route::post('refresh', [AuthController::class, 'refresh']);
|
||||
});
|
||||
});
|
||||
|
||||
// ── Feeds / Informations (public) ──────────────────────
|
||||
Route::get('feeds', [FeedController::class, 'index']);
|
||||
Route::get('feeds/{slug}', [FeedController::class, 'show']);
|
||||
|
||||
// ── Routes authentifiées (membre) ──────────────────────
|
||||
Route::middleware('jwt.auth')->group(function () {
|
||||
|
||||
// Profil
|
||||
Route::get('profil', [ProfilController::class, 'show']);
|
||||
Route::put('profil', [ProfilController::class, 'update']);
|
||||
Route::put('profil/password', [ProfilController::class, 'updatePassword']);
|
||||
Route::delete('profil', [ProfilController::class, 'destroy']);
|
||||
|
||||
// Émotions
|
||||
Route::get('emotions', [EmotionController::class, 'index']);
|
||||
|
||||
// Tracker / Saisies
|
||||
Route::prefix('tracker')->group(function () {
|
||||
Route::get('saisies', [SaisieTrackerController::class, 'index']);
|
||||
Route::post('saisies', [SaisieTrackerController::class, 'store']);
|
||||
Route::put('saisies/{id}', [SaisieTrackerController::class, 'update']);
|
||||
Route::delete('saisies/{id}', [SaisieTrackerController::class, 'destroy']);
|
||||
Route::get('rapports', [SaisieTrackerController::class, 'rapports']);
|
||||
});
|
||||
});
|
||||
|
||||
// ── Admin ──────────────────────────────────────────────
|
||||
Route::middleware(['jwt.auth', 'role:administrateur'])->prefix('admin')->group(function () {
|
||||
|
||||
// Utilisateurs
|
||||
Route::get('utilisateurs', [AdminUtilisateurController::class, 'index']);
|
||||
Route::post('utilisateurs', [AdminUtilisateurController::class, 'store']);
|
||||
Route::get('utilisateurs/{id}', [AdminUtilisateurController::class, 'show']);
|
||||
Route::put('utilisateurs/{id}', [AdminUtilisateurController::class, 'update']);
|
||||
Route::patch('utilisateurs/{id}/toggle-active', [AdminUtilisateurController::class, 'toggleActive']);
|
||||
Route::delete('utilisateurs/{id}', [AdminUtilisateurController::class, 'destroy']);
|
||||
|
||||
// Feeds / Contenus
|
||||
Route::get('feeds', [AdminFeedController::class, 'index']);
|
||||
Route::post('feeds', [AdminFeedController::class, 'store']);
|
||||
Route::put('feeds/{id}', [AdminFeedController::class, 'update']);
|
||||
Route::delete('feeds/{id}', [AdminFeedController::class, 'destroy']);
|
||||
|
||||
// Émotions
|
||||
Route::get('emotions', [AdminEmotionController::class, 'index']);
|
||||
Route::post('emotions', [AdminEmotionController::class, 'store']);
|
||||
Route::put('emotions/{id}', [AdminEmotionController::class, 'update']);
|
||||
Route::delete('emotions/{id}', [AdminEmotionController::class, 'destroy']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
*
|
||||
!private/
|
||||
!public/
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,9 @@
|
||||
compiled.php
|
||||
config.php
|
||||
down
|
||||
events.scanned.php
|
||||
maintenance.php
|
||||
routes.php
|
||||
routes.scanned.php
|
||||
schedule-*
|
||||
services.json
|
||||
@@ -0,0 +1,3 @@
|
||||
*
|
||||
!data/
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*/
|
||||
public function test_the_application_returns_a_successful_response(): void
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*/
|
||||
public function test_that_true_is_true(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: ['resources/css/app.css', 'resources/js/app.js'],
|
||||
refresh: true,
|
||||
}),
|
||||
tailwindcss(),
|
||||
],
|
||||
server: {
|
||||
watch: {
|
||||
ignored: ['**/storage/framework/views/**'],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: cesizen-db
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_DB: cesizen
|
||||
POSTGRES_USER: cesizen
|
||||
POSTGRES_PASSWORD: cesizen_secret
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U cesizen"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
backend:
|
||||
build: ./backend
|
||||
container_name: cesizen-api
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
APP_ENV: local
|
||||
APP_DEBUG: "true"
|
||||
APP_KEY: base64:UMxXo/+o7v1n6E+kimssgw8L2lQ2NQGMuQffn+Vh7lc=
|
||||
APP_URL: http://localhost:8000
|
||||
DB_CONNECTION: pgsql
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
DB_DATABASE: cesizen
|
||||
DB_USERNAME: cesizen
|
||||
DB_PASSWORD: cesizen_secret
|
||||
JWT_SECRET: w89wy05gyYCjGGBXyRHqthKEou5e40er2rdjg69j0mUCRL5ljescaC1CiMl8awtg
|
||||
FRONTEND_URL: http://localhost:3000
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
frontend:
|
||||
build: ./frontend
|
||||
container_name: cesizen-front
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
NEXT_PUBLIC_API_URL: http://localhost:8000/api/v1
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
.next
|
||||
.env.local
|
||||
@@ -0,0 +1,41 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user