🪄 Work in progress

This documentation is still a work in progress, so please don’t mind the mess. We also want to assure you that any corpses you see are used for completely legal and sanctioned necromantic purposes. Absolutely no funny business is taking place here.

Configuration

Why should their pain produce such marvelous beauty? Or is all beauty created through pain? Is that the secret of great art, both human and Melnibonen?
— Elric, Elric of Melniboné

This page describes the different configuration options in Arcanist .

Default redirection target

After a wizard was completed, Arcanist will redirect the user to a different page. By default, the user gets redirected to the URL configured inside the redirect_url key.

Check out this section to see how you can configure a redirect target for a specific wizard.

Configuring the storage driver

Arcanist supports different storage drivers to persist the wizard’s state between steps. You can configure the driver via the storage.driver option. Arcanist ships with two different storage drivers out of the box:
  • DatabaseWizardRepository — This driver saves the wizard state inside a database table. Note that you will have to publish and run the migrations that ship with Arcanist in order to use this driver.
  • CacheWizardRepository — This driver uses your application’s cache to keep track of the wizard state. This driver uses the normal cache configuration that ships with Laravel.

Wizard expiration time

You can configure the expiration time of a wizard with the storage.ttl option. The TTL specifies the number of seconds that a wizard can go without updates before it will be deleted.

When using the database storage driver, Arcanist will compare the updated_at column of the wizard against the TTL to determine if the wizard should be deleted.

Database cleanup

When using the database driver, you need to register an additional Artisan command to periodically clean up expired wizards.

When using the cache driver, this happens automatically since Arcanist uses the configured TTL as the TTL of the cache key.

Action resolvers

You can override the default resolver that gets used to instantiate a wizard’s action with the action_resolver option.

By default, actions get resolved out of the Laravel container so it’s unlikely that you will have to override this setting.

Configuring the response renderer

You can configure the response renderer Arcanist will use to render your views with the renderers.renderer option.

Blade

The BladeResponseRenderer renders your templates by attempting to resolve a Blade template for each step in a wizard. Arcanist uses the following convention to determine the file path of a step’s template.

You can configure the base folder that Arcanist will start looking in when resolving templates with the renderers.blade.view_base_path option.

For instance, changing this option to foobar means that Arcanist will try to resolve a step’s template like so:

Inertia.js

The Inertia.js driver does not ship with Arcanist out of the box. In order to use it, you first need to install it via composer.

You can then use the InertiaResponseRenderer in your config.

The Inertia driver will render your step’s as a Inertia::response. Assuming you are using the default Inertia configuration, Arcanist will attempt to resolve a step’s component using the following convention:

You can configure the base folder that Arcanist will start looking in when resolving templates with the renderers.inertia.component_base_path option.

For instance, changing this value to Forms means Arcanist will try to resolve a step’s template like so:

Configuring the route prefix

Arcanist registers a set of routes for each wizard. As to not conflict with any of your application’s existing routes, the URLs for these routes get prefixed. You can configure this prefix with the route_prefix option.

For instance, changing this prefix to forms means the generated routes would look like this:

Global wizard middleware

You can configure the middleware that gets applied to all wizard routes with the middleware option.

Note that any additional middleware you specify on the wizard gets merged with the global middleware instead of replacing it.