Enabling
Before getting started, ensure you’ve run
php artisan migrate
. Runway comes with a runway_uris
table which will be used to store all of the front-end URIs.route
key to your resource config, with the URI structure you want to use. Feel free to use Antlers in there for anything dynamic, like a slug or a date.
config/runway.php
RunwayRoutes
trait to your Eloquent model.
php please runway:rebuild-uris
to build the “URIs cache” Runway uses to map models to URIs.
Customising the template/layout used
Runway will assume you want to use thedefault
template and the layout
layout for resources.
However, most of the time, you’ll want to change this. To change it, just specify what you want to change them to.
config/runway.php
Available variables
Instead your show/detail view of your model, you’ll have access to a bunch of variables:- All fields configured in your blueprint (with augmentation of course)
- Any fields not in your blueprint but configured in your model, like
created_at
,updated_at
. - Any other variables provided by the Cascade
Static Caching Invalidation
If you’re taking advantage of Statamic’s Static Caching functionality, Runway will automatically invalidate the URI of your models on save. You may also configure additional URIs to be invalidated on save.URI Cache
Since Runway allows you to define your routes using Antlers, much like collections, Runway needs to index all the possible URIs so it can efficiently find the related Eloquent model. Runway uses therunway_uris
table to do this. Unless disabled, your application will have a runway_uris
table, which is responsible for mapping URIs to Eloquent models.
Anytime you create, update or delete an Eloquent model, Runway will update its mappings in the runway_uris
table.
Building the URI Cache
When configuring front-end routing in an application with existing models, you should run thephp please runway:rebuild-uris
command to build the Runway’s “URI Cache”.
If you wish to limit the models being “cached” by the runway:rebuild-uris
command, you may add the runwayRoutes
query scope to your model:
Customizing the table name
By default, Runway will use therunway_uris
table to store the “URI Cache”. If you wish to change the name of the table, you may do so in the runway.php
configuration file: