| Current Path : /var/www/html/dynaweb-cms-v1/app/Models/Backend/ |
| Current File : /var/www/html/dynaweb-cms-v1/app/Models/Backend/FrontendComponent.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_components')]
#[Fillable([
'name', 'code', 'content', 'type', 'category', 'status',
])]
class FrontendComponent extends Model
{
use HasFactory;
protected function casts(): array
{
return [
'status' => 'boolean',
];
}
public function pages()
{
return $this->belongsToMany(
FrontendPage::class,
'frontend_page_components',
'component_fk',
'page_fk'
)->withPivot('sort', 'params')->orderByPivot('sort');
}
}