chore(app): mises a jour applicatives et normalisation du code (Laravel Pint)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,3 +22,4 @@
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
.idea
|
||||
@@ -13,10 +13,11 @@ use Illuminate\Validation\Rule;
|
||||
class AuthController extends Controller
|
||||
{
|
||||
// AuthController.php
|
||||
public function login(Request $request) {
|
||||
public function login(Request $request)
|
||||
{
|
||||
$fields = $request->validate([
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string'
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
// Log::info('Tentative de connexion', $request->all());
|
||||
@@ -24,18 +25,18 @@ class AuthController extends Controller
|
||||
$user = User::where('email', $fields['email'])->first();
|
||||
|
||||
// Vérification du mot de passe haché (Sécurité)
|
||||
if(!$user || !Hash::check($fields['password'], $user->password)) {
|
||||
if (! $user || ! Hash::check($fields['password'], $user->password)) {
|
||||
return response([
|
||||
'status' => 'error',
|
||||
'message' => 'Identifiants invalides'
|
||||
'message' => 'Identifiants invalides',
|
||||
], 401);
|
||||
}
|
||||
|
||||
// Vérification si le compte est actif
|
||||
if (!$user->is_active) {
|
||||
if (! $user->is_active) {
|
||||
return response([
|
||||
'status' => 'error',
|
||||
'message' => 'Votre compte a été désactivé par un administrateur.'
|
||||
'message' => 'Votre compte a été désactivé par un administrateur.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@ class AuthController extends Controller
|
||||
return response([
|
||||
'status' => 'success',
|
||||
'user' => $user,
|
||||
'token' => $token
|
||||
'token' => $token,
|
||||
], 200);
|
||||
}
|
||||
|
||||
@@ -62,14 +63,14 @@ class AuthController extends Controller
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
|
||||
|
||||
Log::info('Tentative de création', $request->all());
|
||||
|
||||
if ($validator->fails()) {
|
||||
Log::info( $validator->errors());
|
||||
Log::info($validator->errors());
|
||||
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'errors' => $validator->errors()
|
||||
'errors' => $validator->errors(),
|
||||
], 422);
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ class AuthController extends Controller
|
||||
'status' => 'success',
|
||||
'message' => 'Compte créé avec succès',
|
||||
'user' => $user,
|
||||
'token' => $token
|
||||
'token' => $token,
|
||||
], 201);
|
||||
}
|
||||
|
||||
@@ -100,15 +101,15 @@ class AuthController extends Controller
|
||||
'email' => [
|
||||
'sometimes',
|
||||
'email',
|
||||
Rule::unique('users')->ignore($user->id) // Empêche les doublons en BDD
|
||||
Rule::unique('users')->ignore($user->id), // Empêche les doublons en BDD
|
||||
],
|
||||
]);
|
||||
|
||||
// 2. Vérification de sécurité (RGPD/Confidentialité)
|
||||
if (!Hash::check($request->current_password, $user->password)) {
|
||||
if (! Hash::check($request->current_password, $user->password)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Le mot de passe actuel est incorrect'
|
||||
'message' => 'Le mot de passe actuel est incorrect',
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ class AuthController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'user' => $user
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\EmotionRecord;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EmotionController extends Controller
|
||||
@@ -18,7 +17,7 @@ class EmotionController extends Controller
|
||||
{
|
||||
Log::info('Tentative d\'enregistrement d\'émotion', [
|
||||
'user' => $request->user()->id,
|
||||
'data' => $request->all()
|
||||
'data' => $request->all(),
|
||||
]);
|
||||
|
||||
try {
|
||||
@@ -35,7 +34,8 @@ class EmotionController extends Controller
|
||||
|
||||
return response()->json($record, 201);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Erreur enregistrement émotion : ' . $e->getMessage());
|
||||
Log::error('Erreur enregistrement émotion : '.$e->getMessage());
|
||||
|
||||
return response()->json(['error' => 'Erreur serveur'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Information;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class InformationController extends Controller
|
||||
{
|
||||
@@ -16,7 +15,7 @@ class InformationController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'data' => $informations
|
||||
'data' => $informations,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -24,16 +23,16 @@ class InformationController extends Controller
|
||||
{
|
||||
$information = Information::where('is_published', true)->find($id);
|
||||
|
||||
if (!$information) {
|
||||
if (! $information) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Information non trouvée'
|
||||
'message' => 'Information non trouvée',
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'data' => $information
|
||||
'data' => $information,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\StressEvent;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StressDiagnosticController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DashboardController extends Controller
|
||||
@@ -17,7 +15,7 @@ class DashboardController extends Controller
|
||||
$stats = [
|
||||
'relaxation_time' => '45 min',
|
||||
'stress_status' => 'Stable',
|
||||
'last_diagnostic' => 'il y a 3 jours'
|
||||
'last_diagnostic' => 'il y a 3 jours',
|
||||
];
|
||||
|
||||
return view('welcome', compact('user', 'stats'));
|
||||
|
||||
@@ -24,6 +24,7 @@ class AuthController extends Controller
|
||||
|
||||
if (Auth::attempt($credentials)) {
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->intended('/');
|
||||
}
|
||||
|
||||
@@ -61,6 +62,7 @@ class AuthController extends Controller
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect('/login');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ResultatDiag;
|
||||
use App\Models\StressEvent;
|
||||
use App\Services\StressCalculator;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -14,23 +16,25 @@ class DiagnosticController extends Controller
|
||||
$events = StressEvent::all();
|
||||
$history = [];
|
||||
if (Auth::check()) {
|
||||
$history = \App\Models\ResultatDiag::where('id_user', Auth::id())
|
||||
$history = ResultatDiag::where('id_user', Auth::id())
|
||||
->orderBy('date_passage', 'desc')
|
||||
->take(5)
|
||||
->get();
|
||||
}
|
||||
|
||||
return view('diagnostics.index', compact('events', 'history'));
|
||||
}
|
||||
|
||||
public function history()
|
||||
{
|
||||
$history = \App\Models\ResultatDiag::where('id_user', Auth::id())
|
||||
$history = ResultatDiag::where('id_user', Auth::id())
|
||||
->orderBy('date_passage', 'desc')
|
||||
->get();
|
||||
|
||||
return view('diagnostics.history', compact('history'));
|
||||
}
|
||||
|
||||
public function store(Request $request, \App\Services\StressCalculator $calculator)
|
||||
public function store(Request $request, StressCalculator $calculator)
|
||||
{
|
||||
// Logique pour calculer le score Holmes-Rahe
|
||||
$totalPoints = 0;
|
||||
@@ -43,7 +47,7 @@ class DiagnosticController extends Controller
|
||||
|
||||
// Enregistrement si l'utilisateur est connecté
|
||||
if (Auth::check()) {
|
||||
\App\Models\ResultatDiag::create([
|
||||
ResultatDiag::create([
|
||||
'id_user' => Auth::id(),
|
||||
'score_total' => $totalPoints,
|
||||
'niveau_stress' => $niveauStress,
|
||||
|
||||
@@ -12,6 +12,7 @@ class EmotionController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$records = EmotionRecord::where('user_id', Auth::id())->latest()->get();
|
||||
|
||||
return view('emotions.index', compact('records'));
|
||||
}
|
||||
|
||||
@@ -20,14 +21,14 @@ class EmotionController extends Controller
|
||||
$request->validate([
|
||||
'emotion' => 'required|string',
|
||||
'intensity' => 'required|integer|min:1|max:5',
|
||||
'note' => 'nullable|string'
|
||||
'note' => 'nullable|string',
|
||||
]);
|
||||
|
||||
EmotionRecord::create([
|
||||
'user_id' => Auth::id(),
|
||||
'emotion' => $request->emotion,
|
||||
'intensity' => $request->intensity,
|
||||
'note' => $request->note
|
||||
'note' => $request->note,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Émotion enregistrée');
|
||||
|
||||
@@ -23,7 +23,7 @@ class ProfileController extends Controller
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,' . $user->id],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,'.$user->id],
|
||||
]);
|
||||
|
||||
$user->fill($validated);
|
||||
|
||||
@@ -4,9 +4,7 @@ namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\RelaxationActivity;
|
||||
use App\Models\Favorite;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RelaxationController extends Controller
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class ResultatDiag extends Model
|
||||
'date_passage',
|
||||
'score_total',
|
||||
'niveau_stress',
|
||||
'event_ids'
|
||||
'event_ids',
|
||||
];
|
||||
|
||||
public function user()
|
||||
@@ -26,8 +26,11 @@ class ResultatDiag extends Model
|
||||
|
||||
public function getEventsAttribute()
|
||||
{
|
||||
if (!$this->event_ids) return collect();
|
||||
if (! $this->event_ids) {
|
||||
return collect();
|
||||
}
|
||||
$ids = explode(';', $this->event_ids);
|
||||
|
||||
return StressEvent::whereIn('id', $ids)->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -20,7 +21,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
if (config('app.env') === 'production' || config('app.env') === 'local') {
|
||||
\Illuminate\Support\Facades\URL::forceScheme('https');
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Services;
|
||||
class StressCalculator
|
||||
{
|
||||
public const LEVEL_HIGH = 'Élevé';
|
||||
|
||||
public const LEVEL_MODERATE = 'Modéré';
|
||||
|
||||
public const LEVEL_LOW = 'Faible';
|
||||
|
||||
public function calculateScore(array $points): int
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Providers\AppServiceProvider;
|
||||
use App\Providers\Filament\AdminPanelProvider;
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\Filament\AdminPanelProvider::class,
|
||||
AppServiceProvider::class,
|
||||
AdminPanelProvider::class,
|
||||
];
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\ValidateCsrfToken;
|
||||
use Laravel\Sanctum\Http\Middleware\AuthenticateSession;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
@@ -76,9 +79,9 @@ return [
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||
'authenticate_session' => AuthenticateSession::class,
|
||||
'encrypt_cookies' => EncryptCookies::class,
|
||||
'validate_csrf_token' => ValidateCsrfToken::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
@@ -30,7 +31,7 @@ class UserFactory extends Factory
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
'id_role' => \App\Models\Role::first() ?? \App\Models\Role::create(['libelle' => 'Utilisateur']),
|
||||
'id_role' => Role::first() ?? Role::create(['libelle' => 'Utilisateur']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,19 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('libelle');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('roles'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
@@ -17,5 +19,9 @@ return new class extends Migration {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('users'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('stress_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('event_name');
|
||||
@@ -13,5 +15,9 @@ return new class extends Migration {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('stress_events'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stress_events');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('relaxation_activities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
@@ -17,5 +19,9 @@ return new class extends Migration {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('relaxation_activities'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('relaxation_activities');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('resultat_diags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('id_user')->constrained('users')->onDelete('cascade');
|
||||
@@ -16,5 +18,9 @@ return new class extends Migration {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('resultat_diags'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('resultat_diags');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('emotion_records', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
@@ -15,5 +17,9 @@ return new class extends Migration {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('emotion_records'); }
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('emotion_records');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
@@ -16,7 +16,7 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'audio',
|
||||
'category' => 'Méditation',
|
||||
'url' => 'https://www.youtube.com/watch?v=sz7cpV7ERsY',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
'image_url' => 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
[
|
||||
'title' => 'Yoga Doux pour le Soir',
|
||||
@@ -24,7 +24,7 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'video',
|
||||
'category' => 'Sport',
|
||||
'url' => 'https://www.youtube.com/watch?v=v7AYKMP6rOE',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1544367567-0f2fcb009e0b?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
'image_url' => 'https://images.unsplash.com/photo-1544367567-0f2fcb009e0b?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
[
|
||||
'title' => 'Bruits de Plage et Vagues',
|
||||
@@ -32,7 +32,7 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'audio',
|
||||
'category' => 'Musique',
|
||||
'url' => 'https://www.youtube.com/watch?v=0_fS_pS_B0U',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
'image_url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
[
|
||||
'title' => 'Comprendre le Cycle du Stress',
|
||||
@@ -40,7 +40,7 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'article',
|
||||
'category' => 'Lecture',
|
||||
'url' => 'https://www.santepubliquefrance.fr',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1512820790803-83ca734da794?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
'image_url' => 'https://images.unsplash.com/photo-1512820790803-83ca734da794?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
[
|
||||
'title' => 'Musique Classique pour la Concentration',
|
||||
@@ -48,7 +48,7 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'audio',
|
||||
'category' => 'Musique',
|
||||
'url' => 'https://www.youtube.com/watch?v=5Qq3m9G4_4A',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1514119412350-e174d90d280e?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
'image_url' => 'https://images.unsplash.com/photo-1514119412350-e174d90d280e?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
[
|
||||
'title' => 'Techniques de Respiration Wim Hof',
|
||||
@@ -56,8 +56,8 @@ class RelaxationActivitySeeder extends Seeder
|
||||
'type' => 'video',
|
||||
'category' => 'Respiration',
|
||||
'url' => 'https://www.youtube.com/watch?v=tybOi4hjZFQ',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1518199266791-5375a83190b7?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80'
|
||||
]
|
||||
'image_url' => 'https://images.unsplash.com/photo-1518199266791-5375a83190b7?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($activities as $activity) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\Role;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
@@ -18,7 +18,7 @@ class RoleSeeder extends Seeder
|
||||
];
|
||||
|
||||
foreach ($roles as $role) {
|
||||
\App\Models\Role::create($role);
|
||||
Role::create($role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\StressEvent;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class StressEventSeeder extends Seeder
|
||||
@@ -56,7 +56,7 @@ class StressEventSeeder extends Seeder
|
||||
];
|
||||
|
||||
foreach ($events as $event) {
|
||||
\App\Models\StressEvent::create($event);
|
||||
StressEvent::create($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-6
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\AuthController;
|
||||
use App\Http\Controllers\Api\EmotionController;
|
||||
use App\Http\Controllers\Api\InformationController;
|
||||
use App\Http\Controllers\Api\StressDiagnosticController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Api\AuthController;
|
||||
use App\Http\Controllers\Api\StressDiagnosticController;
|
||||
|
||||
// Route pour le login (accessible par le visiteur anonyme)
|
||||
Route::post('/login', [AuthController::class, 'login']);
|
||||
@@ -23,10 +25,10 @@ Route::middleware('auth:sanctum')->group(function () {
|
||||
// Route pour enregistrer un diagnostic effectué sur mobile
|
||||
Route::post('/stress-diagnostics', [StressDiagnosticController::class, 'store']);
|
||||
|
||||
Route::get('/emotions', [App\Http\Controllers\Api\EmotionController::class, 'index']);
|
||||
Route::post('/emotions', [App\Http\Controllers\Api\EmotionController::class, 'store']);
|
||||
Route::get('/emotions', [EmotionController::class, 'index']);
|
||||
Route::post('/emotions', [EmotionController::class, 'store']);
|
||||
|
||||
// Routes pour les informations (accessibles aux utilisateurs connectés)
|
||||
Route::get('/informations', [App\Http\Controllers\Api\InformationController::class, 'index']);
|
||||
Route::get('/informations/{id}', [App\Http\Controllers\Api\InformationController::class, 'show']);
|
||||
Route::get('/informations', [InformationController::class, 'index']);
|
||||
Route::get('/informations/{id}', [InformationController::class, 'show']);
|
||||
});
|
||||
|
||||
+5
-7
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\Web\EmotionController;
|
||||
use App\Http\Controllers\Web\DiagnosticController;
|
||||
use App\Http\Controllers\Web\RelaxationController;
|
||||
use App\Http\Controllers\Web\AuthController;
|
||||
use App\Http\Controllers\Web\ProfileController;
|
||||
|
||||
use App\Http\Controllers\Web\DiagnosticController;
|
||||
use App\Http\Controllers\Web\EmotionController;
|
||||
use App\Http\Controllers\Web\InformationController;
|
||||
use App\Http\Controllers\Web\ProfileController;
|
||||
use App\Http\Controllers\Web\RelaxationController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Public Routes
|
||||
Route::get('/', [DashboardController::class, 'index'])->name('home');
|
||||
|
||||
@@ -13,3 +13,4 @@
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
.idea
|
||||
@@ -43,3 +43,5 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
.idea
|
||||
Reference in New Issue
Block a user