hasComposition()

* renderRegion()
* draft and published-state handling
* document and placement scheduling
* disabled-placement filtering
* ordered region rendering
* safe fallback when composition tables or document views are missing
* compatibility with common alternative column names
This commit is contained in:
Mark Gregory
2026-07-27 09:43:42 +01:00
parent a211b10e29
commit c972808d0a
22 changed files with 455 additions and 754 deletions
+6 -4
View File
@@ -1,15 +1,17 @@
<?php
declare(strict_types=1);
namespace Modules\Content\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Pages\Models\Page;
final class PageContent extends Model
{
protected $table = 'page_content';
protected $fillable = ['page_id','page_key','content_document_id','region','sort_order','is_enabled','visibility_rules','presentation','starts_at','ends_at'];
protected function casts(): array { return ['is_enabled'=>'boolean','visibility_rules'=>'array','presentation'=>'array','starts_at'=>'datetime','ends_at'=>'datetime']; }
protected $fillable = ['page_key','region','content_document_id','sort_order','is_enabled','published_at','expires_at'];
protected $casts = ['is_enabled'=>'boolean','published_at'=>'datetime','expires_at'=>'datetime'];
public function document(): BelongsTo { return $this->belongsTo(ContentDocument::class, 'content_document_id'); }
public function page(): BelongsTo { return $this->belongsTo(Page::class); }
}