39 lines
799 B
PHP
39 lines
799 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class SectionPage extends Model
|
|
{
|
|
protected $table = 'section_pages';
|
|
|
|
protected $fillable = [
|
|
'page_id',
|
|
'name',
|
|
'visibility',
|
|
'data',
|
|
];
|
|
|
|
protected $casts = [
|
|
'visibility' => 'boolean',
|
|
'data' => 'object',
|
|
];
|
|
|
|
public function page(): BelongsTo
|
|
{
|
|
return $this->belongsTo(StaticPage::class);
|
|
}
|
|
|
|
public function blocks(): HasMany
|
|
{
|
|
return $this->hasMany(Block::class, 'section_id');
|
|
}
|
|
|
|
public function pictos(): HasMany
|
|
{
|
|
return $this->hasMany(Picto::class, 'section_id')->orderBy('order');
|
|
}
|
|
}
|