DEV Community

Discussion on: Getting Started with Repository Pattern in Laravel using Inheritance and Dependency Injection

Collapse
 
devqx profile image
Oluwaseun Paul

What would be the approach if one wants to switch implementation at runtime ( say during a post / get request ) ?

Collapse
 
carlomigueldy profile image
Carlo Miguel Dy

At the moment I have no idea how we can change the implementation based on an HTTP request method, but we can definitely change the implementation based on the Controller. We can do that via Contextual Binding, I have actually written an article about that so here is the link dev.to/carlomigueldy/laravel-inver...

Hopefully that helps you :)