45 lines
895 B
PHP
45 lines
895 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\ContentStatus;
|
|
use App\Enums\ContentType;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
#[Fillable([
|
|
'type',
|
|
'title',
|
|
'slug',
|
|
'excerpt',
|
|
'content',
|
|
'taxonomies',
|
|
'meta_title',
|
|
'meta_description',
|
|
'meta_keywords',
|
|
'status',
|
|
'featured_image_id',
|
|
'published_at',
|
|
'created_by',
|
|
'updated_by',
|
|
'deleted_by',
|
|
])]
|
|
class Content extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $casts = [
|
|
'type' => ContentType::class,
|
|
'status' => ContentStatus::class,
|
|
'taxonomies' => 'array',
|
|
'meta_keywords' => 'array',
|
|
'published_at' => 'datetime',
|
|
];
|
|
|
|
public function featuredImage()
|
|
{
|
|
return $this->belongsTo(Media::class, 'featured_image_id');
|
|
}
|
|
}
|