Skip to content

[9.x] Implement runwayLinkFieldtype query scope - #852

Closed
duncanmcclean wants to merge 3 commits into
9.xfrom
link-type-scope
Closed

duncanmcclean wants to merge 3 commits into
9.xfrom
link-type-scope

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

This pull request implements support for a runwayLinkFieldtype query scope, which is applied when resolving a model from the Link fieldtype.

If you need to change which models can be linked to, you may add a runwayLinkFieldtype query scope to your model:

use Illuminate\Database\Eloquent\Attributes\Scope;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    #[Scope]
    protected function runwayLinkFieldtype(Builder $query): void
    {
        $query->where('is_active', true);
    }
}

This works in the same way as the existing runwayListing and runwayRoutes scopes.

This PR also fixes PublishedModelsControllerTest leaving revisions behind in tests/__fixtures__/revisions. This was happening because it was overriding statamic.revisions.path, but revisions are now written via the Stache store, whose directory is configured in TestCase. I've fixed it by deleting the fixtures directory on tear down, like the other revision tests do.

Related: #849

duncanmcclean and others added 2 commits September 4, 2026 10:39
…elsControllerTest`

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VNJoUuntDsQj9K8gSdRd6W
@duncanmcclean duncanmcclean changed the title [9.x] Support a runwayLinks scope when resolving Link fieldtype models [9.x] Implement runwayLinks query scope Sep 4, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VNJoUuntDsQj9K8gSdRd6W
@duncanmcclean duncanmcclean changed the title [9.x] Implement runwayLinks query scope [9.x] Implement runwayLinkFieldtype query scope Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant