45 lines
935 B
PHP
45 lines
935 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',
|
|
'published_url',
|
|
];
|
|
|
|
protected $casts = [
|
|
'scheduled_at' => 'datetime',
|
|
];
|
|
|
|
public function site(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Site::class);
|
|
}
|
|
|
|
public function socialAccount(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SocialAccount::class);
|
|
}
|
|
}
|