Skip to main content

Dev

Installation

To install this module

composer require qore/layout
php artisan vendor:publish --tag=qore.layout.db
php artisan vendor:publish --tag=qore.layout.frontend
php artisan tenants:migrate

This module requires a yarn dependency:

cd frontend && yarn add vue-grid-layout

Usage

To use this module

After the module has been enabled, each detail page will have a button icon in the top right corner that links to the layout builder.

By default, only admins will have the required Permission scope for this: ManagesLayout::class

Disabling this module for specific Resources

In your Resource, you may override the function called layoutBuilderEnabled to return false. That will disable the layout builder from being shown on the Resource.

info

This will not disable saved and published layouts from being shown, you should delete them yourself or unpublish them before enabling this option.

Description

Layout

A layout consists of a name, a minimal screen width to be active, and an optional page title. You can have multiple layouts for different screen sizes. You need to publish a layout before it is active.

Blueprint

A Blueprint is a re-usable content block which you can define yourself.

Elements

Elements are predefined and can be used within blueprints / layouts. For example: Tabs, Label, Line, Title.

Content blocks

Content blocks are pre-defined card / tabs by the back-end. Usually these are logs and relations.

Default Layouts

Exporting

The module registers a command php artisan layout:export which will publish all existing layouts to a folder.

The default folder in which the layouts are exported is layouts in the base path of the app. This may be configured by publishing the Layout modules config:

php artisan vendor:publish --tag=qore.layout.config

The command can also be scheduled to be ran once a day:

use Qore\Layout\Console\ExportCurrentLayouts;

$schedule->command(ExportCurrentLayouts::class)->daily();

Or you can create an Observer for the Layout models and schedule on update/create.

More information about observers here https://laravel.com/docs/8.x/eloquent#observers.

Importing

If your project defines some layouts you may want to always import those layouts when migrating fresh.

You may do that by creating a Seeder php artisan make:seeder LayoutSeeder.

The Layout module exports a Trait that exposes a function that can import all the files specified in the folder from Exporting.

LayoutSeeder.php
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Qore\Layout\Traits\CanSeedDatabase;

class LayoutSeeder extends Seeder
{
use CanSeedDatabase;

public function run()
{
$this->seedLayouts();
}
}

This seedLayouts can be used anywhere, where the application is already booted. (For example commands)

Upgrade Guide

To upgrade this module

composer update qore/layout

If you need to upgrade migrations or Vue components:

php artisan vendor:publish --tag=qore.layout.db --force
php artisan vendor:publish --tag=qore.layout.frontend --force

Release notes

All notable changes will be documented here.


0.8.11 (29 Nov, 2022)

Fixes

  • Color Picker for Labels & Lines doesn't change the state of the layout to modified
  • Fix null being shown inside custom templates for fields

0.8.0 (Dec 30, 2021)

Features
  • Add initial release