Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb-cms-v1/app/Models/Backend/
Upload File :
Current File : /var/www/html/dynaweb-cms-v1/app/Models/Backend/FrontendPage.php

<?php

namespace App\Models\Backend;

use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[Table('frontend_pages')]
#[Fillable([
    'site_fk', 'name', 'slug', 'layout', 'entry_script', 'page_content',
    'use_custom_layout', 'is_default', 'status', 'sort_order',
])]
class FrontendPage extends Model
{
    use HasFactory;

    protected function casts(): array
    {
        return [
            'is_default' => 'boolean',
            'status' => 'boolean',
            'use_custom_layout' => 'boolean',
            'sort_order' => 'integer',
        ];
    }

    public function site()
    {
        return $this->belongsTo(FrontendSite::class, 'site_fk');
    }

    public function components()
    {
        return $this->belongsToMany(
            FrontendComponent::class,
            'frontend_page_components',
            'page_fk',
            'component_fk'
        )->withPivot('sort', 'params')->orderByPivot('sort');
    }
}