Page
Crumbls\Layup\Models\Page
The main model for Layup pages. Uses soft deletes, factory support, and the HasLayupContent trait.
Attributes
| Column | Type | Description |
|---|---|---|
id |
integer | Primary key |
title |
string | Page title |
slug |
string | Unique URL slug |
content |
array (JSON) | Page builder content |
status |
string | draft or published |
meta |
array (JSON) | SEO metadata |
created_at |
timestamp | |
updated_at |
timestamp | |
deleted_at |
timestamp | Soft delete |
Scopes
Page::published()->get(); // Where status = 'published'
Page::draft()->get(); // Where status = 'draft'
SEO methods
$page->getMetaTitle(): string
$page->getMetaDescription(): ?string
$page->getMetaKeywords(): ?string
$page->getMetaTags(): array
$page->getStructuredData(): array // JSON-LD schemas
Revision methods
$page->revisions(): HasMany
$page->saveRevision(?string $note = null): PageRevision
$page->restoreRevision(PageRevision $revision): void
URL and rendering
$page->getUrl(): string // Frontend URL based on config prefix
$page->toHtml(): string // Render content to HTML (from HasLayupContent)
$page->getContentTree(): array // Get Row/Column/Widget object tree
$page->getUsedClasses(): array // CSS classes in content
Static methods
Page::sitemapEntries(): array // All published pages as sitemap data
Customization
The table name is configurable:
// config/layup.php
'pages' => [
'table' => 'layup_pages',
'model' => \Crumbls\Layup\Models\Page::class,
],
To extend the model, create your own and update the config:
namespace App\Models;
use Crumbls\Layup\Models\Page as BasePage;
class Page extends BasePage
{
// Custom behavior
}
PageRevision
Crumbls\Layup\Models\PageRevision
Stores content snapshots for version history.
Attributes
| Column | Type | Description |
|---|---|---|
id |
integer | Primary key |
page_id |
foreignId | Parent page |
content |
array (JSON) | Content snapshot |
note |
string (nullable) | Revision note |
author |
string (nullable) | Who saved it |
created_at |
timestamp |
Relationships
$revision->page(): BelongsTo // Parent page
Contributors
Thank you to everyone who has contributed to this package. Every pull request, bug report, and idea makes a difference.