Skip to content

Commit 1cef089

Browse files
committed
Document eager loading on resources
1 parent edcbd28 commit 1cef089

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/resources.md

+15
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,21 @@ If you'd like to specify a different field, you may do so by setting the `title_
168168
],
169169
```
170170

171+
### Eager Loading
172+
173+
To help with performance, Runway will automatically ["eager load"](https://laravel.com/docs/master/eloquent-relationships#eager-loading) any Eloquent relationships it knows about based on the fields you've defined in your blueprint.
174+
175+
However, if you wish, you can override the relationships that get eager loaded by providing the `with` option on your resource:
176+
177+
```php
178+
'resources' => [
179+
\App\Models\Order::class => [
180+
'name' => 'Orders',
181+
'with' => ['lineItems', 'customer'],
182+
],
183+
],
184+
```
185+
171186
## Actions
172187

173188
In much the same way with entries, you can create custom Actions which will be usable in the listing tables provided by Runway.

0 commit comments

Comments
 (0)