feat: initialisation complète du projet CESIZen
- Backend Laravel 11 (API REST, JWT auth, PostgreSQL) - Frontend Next.js 14 (React, TypeScript, Tailwind CSS) - Docker Compose (PostgreSQL, backend, frontend) - Modules : auth, profil, tracker émotions, informations, admin
This commit is contained in:
@@ -0,0 +1,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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user