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 can automatically discover form, table, fragment, and action definitions by scanning a path and mapping it to a namespace:

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

Each entry maps a filesystem path to its root namespace. You may also use the array form to be explicit:

'discover' => [
['path' => base_path('app/Lattice'), 'namespace' => 'App\\Lattice'],
],

Instead of (or in addition to) discovery, list definition classes under the relevant registered key:

'forms' => [
'registered' => [
\App\Forms\ContactForm::class,
],
],

The same registered array exists for tables, fragments, actions, and bulk-actions.

You can also register 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]);
Lattice::discover(app_path('Lattice'), 'App\\Lattice');

Each definition type is served by a dedicated endpoint with its own middleware stack. The defaults:

TypeEndpointMiddleware
Formslattice/forms/{form}web
Tableslattice/tables/{table}web
Fragmentslattice/fragments/{fragment}web
Actionslattice/actions/{action}web
Bulk actionslattice/bulk-actions/{bulkAction}web

Add authentication or other middleware per type:

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

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,
],