<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Page extends Model
{
    protected $fillable = [
        'title', 'slug', 'content', 'meta_title', 'meta_description',
        'status', 'show_in_menu', 'sort_order', 'created_by',
    ];
    protected $casts = ['show_in_menu' => 'boolean'];

    public function creator() { return $this->belongsTo(User::class, 'created_by'); }
    public function scopePublished($q) { return $q->where('status', 'published'); }
}
