Route model Binding
I have different models, where I have a
published_at
date as a field and I have different routes, where I use these models with route bindings.
On the front end, I only want to show "published" models (aka published_at > now()
). This is easily done by adding the following to the models:
The problem is, that this logic obviously also kicks in in admin panel, so I get a 404 on "unpublished" resources.
Any elegent solutions for this? For example, can I exclude somehow the admin from my resolveRouteBindingQuery
logic?1 Reply
Sounds like a scope would be better. Then you could either add or remove it as necessary.