Skip to main content

Creating & managing blueprints

Every resource will have it’s own blueprint. Just like with collections, you can manage the blueprints in the Control Panel. Runway blueprints in the Control Panel When configuring fields, make sure that the field handles in your blueprint should match up exactly with the column names in the database, otherwise bad things will happen. You’ll also want to ensure the database column type matches the fieldtype you’re trying to use (see Supported Fieldtypes).

Supported Fieldtypes

Runway supports pretty much ALL fieldtypes available in Statamic, including Bard. As long as you have the correct fieldtype and the correct column type, everything should “just work”! For simplicity, here’s a table matching Statamic’s Core fieldtypes with the correct column types:
FieldtypeColumn TypeNotes
Arrayjson
Asset Containerstring/json
Assetsstring/json
Bardstring/jsonIf ‘Display HTML’ is true, then Bard will save as a string.
Button Groupstring
Checkboxesjson
Codestring
Collectionsstring/jsonIf ‘Max items’ is 1, column type should be string. Otherwise, json is what you want.
Colorstring
Datestring/rangeFormat is specified field configuration options. Ranges are should be stored as json.
Dictionarystring/jsonIf ‘Max items’ is 1, column type should be string. Otherwise, json is what you want.
Entriesstring/jsonIf ‘Max items’ is 1, column type should be string. Otherwise, json is what you want.
Formstring/jsonIf ‘Max items’ is 1, column type should be string. Otherwise, json is what you want.
Gridjson
Groupjson
Hiddenstring
HTML-UI only
Iconstring
Integerinteger
Linkjson
Listjson
Markdownstring
Navsstring/json
Radiostring
Rangestring
Replicatorjson
Revealer-UI only
Section-UI only
Selectstring/integer/json
Sitesstring/json
Slugstring
Spacer-UI only
Structuresjson
Tablejson
Tagsjson
Taxonomiesstring/json
Templatestring
Termsstring/json
Textstring
Textareastring
Timestring
Toggleboolean
User Groupsstring/jsonWhen the resource is the User model, you don’t need to create a column for this fieldtype.
User Rolesstring/jsonWhen the resource is the User model, you don’t need to create a column for this fieldtype.
Usersstring/integer/json
Videostring
Widthinteger
YAMLstring

Eloquent Relationships

Runway provides two fieldtypes to let you manage Eloquent Relationships within Statamic:
  • Belongs To
  • Has Many
To find out more about Runway’s fieldtypes, check out the Fieldtypes page.

Nesting fields inside JSON columns

To avoid needing to create a migration for every new field you add to a blueprint, fields can be stored within JSON columns. To do this, you’ll first need to configure the JSON column under the nested_field_prefixes key in your config/runway.php config file.
'resources' => [
    Order::class => [
        'nested_field_prefixes' => [ 
            'address', 
        ], 
    ],
],
Then, when you’re adding fields to your blueprint, simply prefix the column name, like shown below, and Runway will be smart enough to read/write from your JSON column. 🧠
-
  handle: address_street_name # Represents the street_name key, in the address column.
  field:
    type: text
    display: 'Street Name'
Heads up! In order for Nested Fields to work, you’ll need to define a cast for the JSON column in your Eloquent model.
protected function casts(): array
{
    return [
        'address' => 'array', // or 'json', AsArrayObject::class
    ];
}

Computed Fields

Like Statamic Core, Runway supports the concept of Computed Fields. However, instead of the computed values being part of a callback in your AppServiceProvider, they’re accessors on your Eloquent model. For example, if you wanted to have a full_name field that’s computed based on the user’s first & last name, you’d do something like this in your User model:
use Illuminate\Database\Eloquent\Casts\Attribute;

public function fullName(): Attribute
{
    return Attribute::make(
        get: function () {
            return "{$this->first_name} {$this->last_name}";
        }
    );
}
Then, in your user blueprint, you’d set the field’s visibility to “Computed”: Field's visibility set to computed
It’s worth noting, Runway requires any accessors to be public functions, otherwise the attributes won’t be augmentable.
I