Ajout des Models

This commit is contained in:
2026-03-23 22:20:14 +01:00
parent 97ed7a5fa8
commit fb1f8b26a2
21 changed files with 500 additions and 92 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Activite extends Model
{
//
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Categorie extends Model
{
//
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Commentaire extends Model {
protected $primaryKey = 'ID_Commentaire';
public function auteur() {
return $this->belongsTo(Utilisateur::class, 'ID_Utilisateur');
}
// Relation récursive pour les réponses aux commentaires [cite: 60, 275]
public function reponses() {
return $this->hasMany(Commentaire::class, 'ID_Parent_Commentaire');
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Ressource extends Model {
protected $primaryKey = 'ID_Ressource';
public function type() {
return $this->belongsTo(TypeRessource::class, 'ID_Type_Ressource');
}
public function categories() {
// Relation Many-to-Many via la table pivot Ressource_Categorie [cite: 175]
return $this->belongsToMany(Categorie::class, 'Ressource_Categorie', 'ID_Ressource', 'ID_Categorie');
}
public function createur() {
return $this->belongsTo(Utilisateur::class, 'ID_Utilisateur_Createur');
}
public function commentaires() {
return $this->hasMany(Commentaire::class, 'ID_Ressource');
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
//
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TypeRessource extends Model
{
//
}
-49
View File
@@ -1,49 +0,0 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Models; // Déclare que le modèle est dans app/Models
use Illuminate\Foundation\Auth\User as Authenticatable; // On importe le "User" de base sous un alias
use Illuminate\Notifications\Notifiable;
class Utilisateur extends Authenticatable
{
use Notifiable;
// Indique à Eloquent d'utiliser ta table SQL spécifique [cite: 174, 175]
protected $table = 'Utilisateur';
// Définit la clé primaire personnalisée de ton SQL [cite: 175]
protected $primaryKey = 'ID_Utilisateur';
// Désactive l'auto-incrémentation si nécessaire, ou précise le type
public $incrementing = true;
protected $keyType = 'int';
// Liste des champs modifiables (Mass Assignment)
protected $fillable = [
'Email',
'MotDePasse',
'Pseudo',
'ID_Role',
'Statut'
];
// Cache les données sensibles [cite: 99, 176]
protected $hidden = [
'MotDePasse',
];
// Chiffrement requis par le cahier des charges [cite: 99, 176]
protected $casts = [
'Email' => 'encrypted',
'MotDePasse' => 'hashed',
'DateInscription' => 'datetime',
];
}
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('roles', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('roles');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('utilisateurs', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('activites', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('activites');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('categories');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('commentaires', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('commentaires');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ressources', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ressources');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('type_ressources', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('type_ressources');
}
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+13
View File
@@ -0,0 +1,13 @@
<footer class="gradient-niagara text-white py-12 mt-16">
<div class="container mx-auto px-4 flex flex-col md:flex-row justify-between items-start md:items-center gap-8">
<div>
<p class="font-bold text-lg mb-2">Projet (RE)Sources Relationnelles</p>
<p class="text-sm text-blue-100">Un outil au service de la cohésion sociale.</p>
</div>
<ul class="flex flex-wrap gap-6 text-sm">
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Mentions Légales</a></li>
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Politique de Confidentialité</a></li>
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Contactez-nous</a></li>
</ul>
</div>
</footer>
+34
View File
@@ -0,0 +1,34 @@
<header class="border-b border-gray-200 bg-white shadow-sm transition-smooth">
<div class="container mx-auto px-4 py-6 flex flex-wrap items-center justify-between gap-4">
<div class="flex items-center space-x-4">
<div class="flex items-center">
<div class="border-r border-gray-300 pr-4">
<p class="text-xs font-bold uppercase leading-tight text-gray-700">Gouvernement</p>
<p class="text-[10px] uppercase italic text-gray-600 mt-1">Liberté<br>Égalité<br>Fraternité</p>
</div>
</div>
<h1 class="text-xs font-bold uppercase max-w-[150px] text-gray-800 leading-snug">
<img
src="{{ asset('img/logo-ministere.png') }}"
alt="Logo du Ministère des Solidarités et de la Santé"
class="h-16 w-auto mr-4"
>
</h1>
</div>
<div class="hidden md:block flex-grow text-center">
<span class="text-3xl font-black italic tracking-tighter text-gray-900">
(RE)SOURCES <span class="text-niagara underline decoration-candlelight decoration-4 underline-offset-2">RELATIONNELLES</span>
</span>
</div>
<nav class="flex items-center gap-2 whitespace-nowrap">
<a href="/login" class="px-5 py-2.5 text-sm font-bold text-niagara border-2 border-niagara rounded-lg hover:bg-niagara hover:text-white transition-smooth duration-200">
Connexion
</a>
<a href="/register" class="px-5 py-2.5 text-sm font-bold bg-candlelight text-gray-900 rounded-lg shadow-md hover:shadow-lg hover:-translate-y-0.5 transition-smooth duration-200">
S'inscrire
</a>
</nav>
</div>
</header>
+131
View File
@@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Catalogue - (RE)Sources Relationnelles</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
.bg-niagara { background-color: #06989e; }
.text-niagara { color: #06989e; }
.border-niagara { border-color: #06989e; }
.bg-candlelight { background-color: #fce117; }
.transition-smooth { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
</style>
</head>
<body class="bg-gray-50 text-gray-900 font-sans">
@include('layout.header')
<main class="container mx-auto px-4 py-12">
<div class="text-center mb-12">
<h1 class="text-4xl font-extrabold mb-4">Catalogue des <span class="text-niagara">Ressources</span></h1>
<p class="text-gray-600 max-w-2xl mx-auto">Accédez à des outils et conseils pour renforcer vos liens. Filtrez les ressources selon vos besoins.</p>
</div>
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200 mb-10">
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div class="md:col-span-1">
<label class="block text-xs font-bold uppercase text-gray-500 mb-2">Rechercher</label>
<input type="text" placeholder="Ex: Communication non-violente" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-niagara outline-none">
</div>
<div>
<label class="block text-xs font-bold uppercase text-gray-500 mb-2">Catégorie</label>
<select class="w-full px-4 py-2 border rounded-lg outline-none focus:border-niagara">
<option>Toutes</option>
<option>Communication</option>
<option>Développement Personnel</option>
<option>Gestion de conflit</option>
</select>
</div>
<div>
<label class="block text-xs font-bold uppercase text-gray-500 mb-2">Type de Relation</label>
<select class="w-full px-4 py-2 border rounded-lg outline-none focus:border-niagara">
<option>Toutes</option>
<option>Conjoints</option>
<option>Famille (Parents/Enfants)</option>
<option>Professionnelle</option>
<option>Amis</option>
</select>
</div>
<div>
<label class="block text-xs font-bold uppercase text-gray-500 mb-2">Format</label>
<select class="w-full px-4 py-2 border rounded-lg outline-none focus:border-niagara">
<option>Tous</option>
<option>Article</option>
<option>Vidéo</option>
<option>Activité / Jeu</option>
</select>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<div class="bg-white rounded-xl border border-gray-200 overflow-hidden flex flex-col hover:shadow-xl transition-smooth">
<div class="h-48 bg-gray-200 flex items-center justify-center text-5xl">📖</div>
<div class="p-6 flex-grow">
<div class="flex justify-between items-start mb-2">
<span class="text-[10px] font-bold bg-gray-100 px-2 py-1 rounded uppercase">Article</span>
<div class="flex gap-2">
<button title="Ajouter aux favoris" class="text-gray-400 hover:text-red-500">❤️</button>
<button title="Mettre de côté" class="text-gray-400 hover:text-niagara">🔖</button>
</div>
</div>
<h3 class="font-bold text-xl mb-2">L'écoute active en famille</h3>
<p class="text-gray-600 text-sm mb-4 line-clamp-3">Découvrez comment la méthode de l'écoute active peut transformer vos échanges avec vos enfants et réduire les tensions quotidiennes.</p>
<div class="flex flex-wrap gap-2 mb-6">
<span class="text-[10px] bg-blue-50 text-blue-700 px-2 py-1 rounded font-bold uppercase">Famille</span>
<span class="text-[10px] bg-niagara/10 text-niagara px-2 py-1 rounded font-bold uppercase">Communication</span>
</div>
</div>
<div class="p-6 pt-0 mt-auto">
<a href="#" class="block text-center py-3 bg-gray-900 text-white font-bold rounded-lg hover:bg-niagara transition-smooth">Consulter la ressource</a>
</div>
</div>
<div class="bg-white rounded-xl border-2 border-candlelight overflow-hidden flex flex-col hover:shadow-xl transition-smooth">
<div class="h-48 bg-candlelight/20 flex items-center justify-center text-5xl">🎲</div>
<div class="p-6 flex-grow">
<div class="flex justify-between items-start mb-2">
<span class="text-[10px] font-bold bg-candlelight px-2 py-1 rounded uppercase">Activité Collective</span>
<div class="flex gap-2 text-niagara font-bold text-xs">NOUVEAU</div>
</div>
<h3 class="font-bold text-xl mb-2">Le Jeu des Complices</h3>
<p class="text-gray-600 text-sm mb-4 line-clamp-3">Un jeu de cartes interactif à faire en couple ou entre amis pour redécouvrir vos forces communes et vos meilleurs souvenirs.</p>
<div class="flex flex-wrap gap-2 mb-6">
<span class="text-[10px] bg-pink-50 text-pink-700 px-2 py-1 rounded font-bold uppercase">Couple</span>
<span class="text-[10px] bg-niagara/10 text-niagara px-2 py-1 rounded font-bold uppercase">Jeu</span>
</div>
</div>
<div class="p-6 pt-0 mt-auto">
<button class="w-full py-3 bg-niagara text-white font-bold rounded-lg shadow-md hover:opacity-90 transition-smooth">Lancer l'activité</button>
</div>
</div>
<div class="bg-white rounded-xl border border-gray-200 overflow-hidden flex flex-col hover:shadow-xl transition-smooth">
<div class="h-48 bg-gray-200 flex items-center justify-center text-5xl">🎥</div>
<div class="p-6 flex-grow">
<div class="flex justify-between items-start mb-2">
<span class="text-[10px] font-bold bg-gray-100 px-2 py-1 rounded uppercase">Vidéo</span>
<button title="Déjà exploitée" class="text-niagara"></button>
</div>
<h3 class="font-bold text-xl mb-2">Gérer les conflits au bureau</h3>
<p class="text-gray-600 text-sm mb-4 line-clamp-3">10 minutes pour apprendre à désamorcer une situation tendue avec un collègue sans sacrifier votre bien-être.</p>
<div class="flex flex-wrap gap-2 mb-6">
<span class="text-[10px] bg-orange-50 text-orange-700 px-2 py-1 rounded font-bold uppercase">Pro</span>
<span class="text-[10px] bg-niagara/10 text-niagara px-2 py-1 rounded font-bold uppercase">Médiation</span>
</div>
</div>
<div class="p-6 pt-0 mt-auto">
<a href="#" class="block text-center py-3 border-2 border-gray-900 text-gray-900 font-bold rounded-lg hover:bg-gray-900 hover:text-white transition-smooth">Visionner</a>
</div>
</div>
</div>
</main>
@include('layout.footer')
</body>
</html>
+3 -43
View File
@@ -36,34 +36,7 @@
Aller au contenu principal Aller au contenu principal
</a> </a>
<header class="border-b border-gray-200 bg-white shadow-sm transition-smooth"> @include('layout.header')
<div class="container mx-auto px-4 py-6 flex flex-wrap items-center justify-between gap-4">
<div class="flex items-center space-x-4">
<div class="border-r border-gray-300 pr-4">
<p class="text-xs font-bold uppercase leading-tight text-gray-700">Gouvernement</p>
<p class="text-[10px] uppercase italic text-gray-600 mt-1">Liberté<br>Égalité<br>Fraternité</p>
</div>
<h1 class="text-xs font-bold uppercase max-w-[150px] text-gray-800 leading-snug">
Ministère des Solidarités et de la Santé
</h1>
</div>
<div class="hidden md:block flex-grow text-center">
<span class="text-3xl font-black italic tracking-tighter text-gray-900">
(RE)SOURCES <span class="text-niagara underline decoration-candlelight decoration-4 underline-offset-2">RELATIONNELLES</span>
</span>
</div>
<nav class="flex items-center gap-2 whitespace-nowrap">
<a href="/login" class="px-5 py-2.5 text-sm font-bold text-niagara border-2 border-niagara rounded-lg hover:bg-niagara hover:text-white transition-smooth duration-200">
Connexion
</a>
<a href="/register" class="px-5 py-2.5 text-sm font-bold bg-candlelight text-gray-900 rounded-lg shadow-md hover:shadow-lg hover:-translate-y-0.5 transition-smooth duration-200">
S'inscrire
</a>
</nav>
</div>
</header>
<main id="main-content"> <main id="main-content">
<section class="py-16 md:py-28 gradient-light"> <section class="py-16 md:py-28 gradient-light">
@@ -76,7 +49,7 @@
La plateforme citoyenne dédiée à la qualité des liens : famille, amis, couple ou collègues. La plateforme citoyenne dédiée à la qualité des liens : famille, amis, couple ou collègues.
</p> </p>
<div class="flex flex-col sm:flex-row gap-4 justify-center md:justify-start"> <div class="flex flex-col sm:flex-row gap-4 justify-center md:justify-start">
<a href="#catalogue" class="px-8 py-4 gradient-niagara text-white rounded-lg font-bold text-lg hover:shadow-lg hover:-translate-y-1 transition-smooth duration-200 inline-block"> <a href="/resources" class="px-8 py-4 gradient-niagara text-white rounded-lg font-bold text-lg hover:shadow-lg hover:-translate-y-1 transition-smooth duration-200 inline-block">
Explorer les ressources Explorer les ressources
</a> </a>
<button class="px-8 py-4 bg-white border-2 border-gray-300 rounded-lg font-bold text-lg text-gray-900 hover:border-niagara hover:text-niagara transition-smooth duration-200"> <button class="px-8 py-4 bg-white border-2 border-gray-300 rounded-lg font-bold text-lg text-gray-900 hover:border-niagara hover:text-niagara transition-smooth duration-200">
@@ -124,19 +97,6 @@
</section> </section>
</main> </main>
<footer class="gradient-niagara text-white py-12 mt-16"> @include('layout.footer')
<div class="container mx-auto px-4 flex flex-col md:flex-row justify-between items-start md:items-center gap-8">
<div>
<p class="font-bold text-lg mb-2">Projet (RE)Sources Relationnelles</p>
<p class="text-sm text-blue-100">Un outil au service de la cohésion sociale.</p>
</div>
<ul class="flex flex-wrap gap-6 text-sm">
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Mentions Légales</a></li>
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Politique de Confidentialité</a></li>
<li><a href="#" class="text-blue-100 hover:text-candlelight hover:underline transition-smooth duration-200">Contactez-nous</a></li>
</ul>
</div>
</footer>
</body> </body>
</html> </html>
+4
View File
@@ -5,3 +5,7 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () { Route::get('/', function () {
return view('welcome'); return view('welcome');
}); });
Route::get('/resources', function () {
return view('resources');
});