Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The HasSlug trait breaks scoped model bindings #7

Open
voidgraphics opened this issue Jun 19, 2024 · 0 comments
Open

The HasSlug trait breaks scoped model bindings #7

voidgraphics opened this issue Jun 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@voidgraphics
Copy link
Member

Laravel has a feature to scope bindings based on parent / child relationships, for example the following route

Route::get('/blog/{category}/{post}', PostController::class)->scopeBindings();

would resolve the category model first, and then resolve the post model to only include posts from the specified category model.

This feature breaks when we apply the HasSlug trait on the scoped model (Post in this case), and the scoping simply does not occur. There's no errors, it just injects the wrong model into the controller's parameters, as if it was not scoped.

@voidgraphics voidgraphics added the bug Something isn't working label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant