<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Page extends Model
{
    protected $fillable = [
        'slug', 
        'title_ar', 
        'title_en', 
        'content_ar', 
        'content_en'
    ];

    public function getDynamicTitle()
    {
        $locale = app()->getLocale();
        return $locale === 'en' && $this->title_en ? $this->title_en : $this->title_ar;
    }

    
    public function getDynamicContent()
    {
        $locale = app()->getLocale();
        return $locale === 'en' && $this->content_en ? $this->content_en : $this->content_ar;
    }
}
