Control Panel
- Disable Control Panel functionality
- Custom Icon for CP Nav Item
- Permissions
- Actions
- Scoping Control Panel Results
One of Runway’s core features is the Control Panel integration. Runway will create listing and publish form pages for each of your resources.
The Control Panel functionality is built to work in exactly the same way you’d expect with entries. You can set filters, define scopes and use custom actions.
Disable Control Panel functionality
Technically, you can’t fully disable Runway’s CP feature. However, what you can do is hide the Nav Item from the Control Panel.
1// config/runway.php2 3'resources' => [4 \App\Models\Order::class => [5 'name' => 'Orders',6 'hidden' => true,7 ],8],
Custom Icon for CP Nav Item
Runway has a rather generic icon for resources in the Control Panel Nav. Feel free to change this to something else that better suits your use case (in fact, I’d encourage it).
You can either provide the name of an existing icon packaged into Statamic Core or inline the SVG as a string.
1// config/runway.php 2 3'resources' => [ 4 \App\Models\Order::class => [ 5 'name' => 'Orders', 6 'listing' => [ 7 'cp_icon' => 'date', 8 ], 9 ],10],
Permissions
If you have other users who are not ‘super users’, you may wish to also give them permission to view_create_update specific resources.
Runway gives you granular control over which actions users can/cannot do for each of your resources.
Actions
Runway supports using Statamic Actions to preform tasks on your models.
You may register your own custom actions, as per the Statamic documentation. If you wish to only show an action on one of your models, you can filter it down in the visibleTo
method.
1use App\Models\Post;2 3class YourCustomAction extends Action4{5 public function visibleTo($item)6 {7 return $item instanceof Post;8 }9}
Scoping Control Panel Results
If you don't want to return everything, you may add a scope (runwayListing
) to limit the returned results.
1class YourModel extends Model2{3 public function scopeRunwayListing($query)4 {5 return $query->where('something', true);6 }7}
Scoping search results
On top of scoping your Control Panel results, you may also scope how Runway searches your models. To do this, you may specify a runwaySearch
scope.
1class YourModel extends Model2{3 public function scopeRunwaySearch($query, $searchString)4 {5 // Your own search logic6 }7}