Repository navigation
Support for defining custom scopes for link types #849
indykoning
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The Resource link type is such a welcome addition to runway!
Implementing it i noticed many unused queries running for the link templates i have created.
For my template you can link a "Category" and it takes a url to link to it.
However my category model structure is heavy and weird, it's an EAV structure where each data type has a different table linking to the attribute code and name.
This means i have a default scope to add all these values.
category -> category_int | category_varchar | category_text | category_datetimeThis is not needed for getting the url at all, but since it's a global scope it will eager load.
I noticed resourceLinkType calling newEloquentQuery
https://github.com/statamic-rad-pack/runway/blob/9.x/src/ResourceLinkType.php#L27
This currently allows me to remove that global scope with
Though that would have further impact than just the product links.
It would be nice if we could add a scope which specifically runs for the ResourceLinkType.
All reactions