cms/app/Models/Page.php

46 lines
825 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Page extends Model
{
use HasFactory;
protected $fillable = [
'title',
'slug',
'content',
'cached_html',
'meta_description',
'is_published',
'user_id',
];
protected function casts(): array
{
return [
'content' => 'array',
'is_published' => 'boolean',
];
}
/**
* Get the author of the page.
*/
public function author()
{
return $this->belongsTo(User::class, 'user_id');
}
/**
* Get the navigation item for the page.
*/
public function navigationItem()
{
return $this->hasOne(NavigationItem::class);
}
}