Is there any way I can use the same controller and model for multiple databases?
For example I have a Product model, and a ProductController (CRUD resource controller with index,show,store,update,destroy). The databases,models and controllers are identical.
The only way I found to change the connection is in the model protected $connection = 'connection_name';
But then I would need to duplicate the ProductController for each model.
I was thinking to make ProductController as BaseProductController and extend it for every database but I cannot figure out how to set the connection.