Content Model
Everything editorial in Laravix — pages, posts, archives, plugin-defined types — is a row in the contents table. This article maps the content model: the Content model itself, custom fields, taxonomies, revisions, translations and URLs.
The Content model
Laravix\Cms\Models\Content carries:
| Attribute | Meaning |
|---|---|
site_id |
Owning site (tenant) |
type |
Content type key: page, post, archive, or a plugin type like doc |
title, slug |
Name and URL segment; slug is unique per site and locale |
is_homepage |
At most one per site and locale; renders at / |
status |
ContentStatus enum: draft, published, scheduled |
published_at |
Publish moment for scheduled content; also the sort key for posts |
locale, translation_group_id |
Language and the group linking translations of the same content |
blocks |
JSON array of classic block data (rendered by theme block views) |
grapesjs_data, grapesjs_html |
The visual builder's project data and exported HTML |
sort_order |
Manual ordering (drag & drop in the admin list) |
created_by |
Author (author() relation) |
Content is soft-deleted (recoverable from the Bin), logged in the per-site activity log, and indexed for search via Laravel Scout — only when published.
Content types
Types are registered in code via ContentTypeRegistry — the core registers page, post and archive. A type definition controls the plural/singular labels, whether the type is offered in navigation, whether it has the visual builder, an optional route prefix and which taxonomy types it accepts. See Custom Content Types.
Publication rules
A piece of content is publicly visible when status = published and published_at is null or in the past. The laravix:publish-scheduled command (scheduled every minute) flips scheduled content to published when its time comes.
Custom fields
Content attributes beyond the core columns live in the content_fields table as key–value rows (fields() relation). Two sources define which fields exist:
- Code —
FieldRegistry::content([...])for all types (the core registers the SEO fieldsmeta_title,meta_description,og_image,noindex) andFieldRegistry::contentType('doc', [...])per type. - Database — the Custom fields admin resource, where admins define fields per content type without code.
Field types (Laravix\Cms\Enums\FieldType): text, textarea, rich_text, markdown, image, file, boolean, select, url, date, datetime, number, color. Details in Custom Fields.
Taxonomies
Taxonomy rows are per-site labels with a type (core: category, tag; plugins add more, e.g. doc-category), optional parent_id hierarchy, per-locale translations and drag-orderable sort_order. Content links to taxonomies through the content_taxonomy pivot. A content type can restrict which taxonomy types it accepts via its definition.
Revisions
Every save of the content form writes a ContentRevision snapshot: title, slug, status, homepage flag, publish date, blocks and all field values. Builder saves add revisions of the builder data. Revisions can be reverted from the admin (Revisions relation manager on the edit page).
Translations
Translations of one logical piece of content share a translation_group_id and differ in locale. The Translate action clones the content (including fields) into a new locale as a draft. On the frontend, the default locale renders without a URL prefix and other locales under /{locale}/...; hreflang alternates are emitted automatically for published translations.
URL generation
Content::path() builds the public path: / for the homepage, otherwise /{slug}, prefixed by the content type's route prefix if it has one (e.g. docs → /docs/{slug}) and by the locale for non-default languages. The HandleRedirects middleware serves old URLs registered on the content — see the client article Redirects.
Search text
For full-text search, Laravix maintains a search_text column: stripped text from the builder HTML, classic blocks and field values (up to 60,000 characters), refreshed automatically on save. See Full-text Search.