Files
muninn/app/Models/Post.php
T
Doar MihaiandClaude Sonnet 5 f746c5d6a0 feat: add Post model, migration, and factory
Adds the Post model belonging to Site (required, cascade-deletes with
the site) and SocialAccount (nullable, nulled out on account delete).
Foundation for the Scheduled Posts feature; later tasks build the
Livewire CRUD UI and API on top of this model.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-18 17:07:48 +03:00

44 lines
910 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Post extends Model
{
use HasFactory;
public const TYPES = [
'twitter', 'instagram', 'facebook', 'reddit',
'tiktok', 'linkedin', 'youtube', 'blog', 'other',
];
public const STATUSES = ['draft', 'scheduled', 'published', 'failed'];
protected $fillable = [
'site_id',
'social_account_id',
'type',
'title',
'body',
'status',
'scheduled_at',
];
protected $casts = [
'scheduled_at' => 'datetime',
];
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
public function socialAccount(): BelongsTo
{
return $this->belongsTo(SocialAccount::class);
}
}