Tagixo Docs

Developer Documentation for Laravel, SDK integrations, and extensibility

Core Integration

Database and Models

Shipped Eloquent models, their key columns, methods, and how migrations are published.

Database and Models

Tagixo ships a set of Eloquent models that you can use directly or wrap with your own application models. Tables are prefixed vb_ (legacy) or tgx_ (newer mail/pdf templates). media_items is the only unprefixed table.

You are NOT forced to use these models. Standalone integrations can store the builder JSON in their own tables and ignore the package models entirely. They exist as a convenient default for projects that don't want to build their own schema.

Content models

Page — table vb_pages

The most commonly used model. Stores the full builder JSON plus publish metadata.

Key columns: title, slug (unique), content (JSON), metadata (JSON), status (PageStatus enum), published_at, published_until, parent_id (self-ref FK for hierarchy), order, layout_id (FK to vb_layouts), meta_title, meta_description, og_image, rendered_html (cached HTML), css (cached CSS).

Relations: layout(), parent() (self), children() (self, ordered).

Scopes: published(), root().

Accessors:

  • is_published — true when status is Published AND inside the publish window: (published_at is null or <= now()) AND (published_until is null or >= now())
  • url — builds the hierarchical URL by walking the parent chain

Methods you'll likely call:

  • publish() / unpublish() — toggle status
  • getEffectiveLayout(): ?Layout — returns own layout or Layout::global()
  • invalidateCache() — clears rendered_html + css so the next render rebuilds
  • renderFull(?string $layoutView = null): string — full standalone HTML for the public page
  • toResponse(int $status = 200, array $headers = []): Response — wraps renderFull() in an HTTP Response
  • static isAuthorizedPreviewRequest(Request $request): bool — call this in your PublicPageController to decide whether to bypass the published() gate for builder-issued signed preview URLs

Soft-deleted via the SoftDeletes trait.

MailTemplate — table tgx_mail_templates

Builder-authored email templates. See mail-and-pdf-templates for the rendering pipeline.

Columns: name, slug (unique), subject, preheader, content (JSON), rendered_html, css, status, published_at, metadata. Soft-deleted.

Method: renderHtml(): string — returns email-client-safe HTML with inlined CSS.

PdfTemplate — table tgx_pdf_templates

Builder-authored PDF templates. Same shape as MailTemplate plus three columns that drive the @page rules: paper_size (default A4), orientation (default portrait), margin (default 2cm).

Method: renderHtml(): string — returns print-ready HTML ready for any PDF engine.

Layout and preset models

Layout — table vb_layouts

Header/footer wrappers for pages.

Columns: name, header_content (JSON), footer_content (JSON), header_css, footer_css, header_rendered_html, footer_rendered_html, is_global (boolean).

Static: Layout::global(): ?self returns the single global layout.

Boot hook: saving a layout with is_global = true automatically unsets the flag on all other layouts — only ONE global layout exists at any time.

BuilderTemplate — table vb_builder_templates

Full reusable designs, one per context. Used as the "Save as template" / "Load template" affordances in the builder.

Columns: name, description, content (JSON), context (page|form|mail|pdf), thumbnail.

Scopes: forContext(string), pages(), forms(), mails(), pdfs(), ordered().

BuilderLibraryItem — table vb_builder_library_items

Section/row/column-level presets. Lighter than templates — meant for reusing pieces, not whole pages.

Columns: name, description, type (section|row|column), category, content (JSON), context, is_global (boolean).

When is_global = true the item is synced bidirectionally on load/save — editing the item anywhere updates all places where it's used.

Globals

GlobalVariable — table vb_global_variables

User-defined design tokens. Emitted by the renderer as :root { --vb-{key}: {value}; } so any module can reference them via CSS variables.

Columns: key (unique), name, type (color|font|number), group, value (JSON), order.

Scopes: colors(), fonts(), numbers(), ordered().

The package ships a GlobalVariablesSeeder that creates default values from config.

CustomFont — table vb_custom_fonts

Uploaded fonts available in the FontPicker. Supports woff2, woff, ttf, otf.

Columns: family, weight (100–900), style (normal|italic), format, file_path, original_name, file_size.

Accessor: url returns the public Storage URL.

Static: CustomFont::getFamilies() groups variants by family.

Media

Media — table media_items

Uploaded files and their crop variants. See media-gallery for the full lifecycle.

PageStatus enum

Backed string enum used by Page, MailTemplate, PdfTemplate:

enum PageStatus: string {
    case Draft     = 'draft';
    case Published = 'published';
    case Scheduled = 'scheduled';
    case Archived  = 'archived';
}

Helpers: label(): string and color(): string (gray|success|warning|danger).

Migrations

The package ships 10 migrations covering all the tables above. Publish them when you want a copy in your repo:

php artisan vendor:publish --tag=tagixo-migrations

Or set tagixo.auto_load_migrations to true to skip the publish step and load migrations directly from the package.

Upgrades

When upgrading the package, re-run vendor:publish --tag=tagixo-migrations to bring in any new migration files (Laravel will pick them up on the next php artisan migrate). Soft-deleted rows on Page, MailTemplate, PdfTemplate are preserved across version bumps — schema changes are additive whenever possible.

If you customize the destination of published migrations or seeders, configure tagixo.publishing.migrations_path and publishing.seeders_path accordingly.