Files
muninn/app/Models/Post.php
T

44 lines
910 B
PHP
Raw Normal View History

<?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);
}
}