Skip to content

Configuration

After publishing the config with php artisan vendor:publish --tag="lattice-config", you can tune Lattice in config/lattice.php.

Lattice automatically discovers form, table, fragment, action, layout, and page definitions by scanning the configured paths for classes carrying the matching attribute:

'discover' => [
base_path('app'),
],

List every path Lattice should scan. Discovery walks the files directly, so no namespace mapping is needed.

Instead of (or in addition to) discovery, register definition classes at runtime through the Lattice facade — useful from a service provider:

use Lattice\Lattice\Facades\Lattice;
Lattice::forms([\App\Forms\ContactForm::class]);
Lattice::tables([\App\Tables\UsersTable::class]);

The same method exists for fragments, actions, bulkActions, layouts, pages, and remoteSources.

Each definition type is served by a dedicated endpoint with its own middleware stack. The defaults all run behind web and auth:

Type Endpoint Middleware
Forms lattice/forms/{form} ['web', 'auth']
Tables lattice/tables/{table} ['web', 'auth']
Fragments lattice/fragments/{fragment} ['web', 'auth']
Actions lattice/actions/{action} ['web', 'auth']
Bulk actions lattice/bulk-actions/{bulkAction} ['web', 'auth']
Remote sources lattice/remote-sources/{source}/token ['web', 'auth']
Notifications lattice/notifications ['web', 'auth']

Change the endpoint or middleware stack per type:

'forms' => [
'endpoint' => 'lattice/forms/{form}',
'middleware' => ['web', 'auth'],
],

The notifications block also takes per_page, polling_interval, and prune_after_days — see Notifications.

File uploads are stored through Laravel’s filesystem. Pending uploads live under a temporary prefix and are served with short-lived signed URLs until the form is submitted:

'files' => [
'disk' => env('LATTICE_FILES_DISK', 'public'),
'temp_prefix' => 'tmp',
'url_ttl' => 5,
],
  • disk — the storage disk uploads are written to.
  • temp_prefix — the directory pending (not-yet-finalized) uploads are placed in.
  • url_ttl — how long, in minutes, a temporary signed file URL stays valid.

The locales Lattice exposes to the client and the i18n runtime:

'i18n' => [
'locales' => ['en'],
'preload_locales' => [],
],
  • locales — the locales available to the application.
  • preload_locales — locales whose translations are bundled into the initial page payload instead of being fetched on demand. Leave empty to load every locale lazily.

Toggles the realtime broadcasting layer. When disabled, page listeners are not serialized to the client:

'realtime' => [
'enabled' => env('LATTICE_REALTIME_ENABLED', true),
],

Component references embedded in the page payload are signed. security.ref_lifetime controls how long, in minutes, a signed reference stays valid:

'security' => [
'ref_lifetime' => 30,
],

Where php artisan lattice:typescript writes the generated type definitions, and the module name they are published under:

'typescript' => [
'output' => resource_path('js/lattice/generated.d.ts'),
'module' => '@lattice-php/lattice',
],