Category: Laravel, Laravel, PHP, PHP

Of course they work with Eloquent, but turns they work with any class.

Before we get into this idea, I just want to cover when I would reach for a Gate or a Policy.

For whatever reason we have setup an endpoint you can hit and it triggers your application to deploy.

This is why we can't use a Policy for our Keyboard controller; we don't have an internal representation of a keyboard!

We can now use Route Model Binding to get our Keyboard object and pass it directly to our authorization call.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners