vendredi 19 janvier 2018

Switching Database in Eloquent Based On User's Roles

Hello in my lumen app I have created several users I would like to use to perform test transactions live on my server, currently test db transactions are mixed with actual records which is a real pain when removing.

What I want to do is check the user when they perform an action if they are a test user it should switch to my test_db and save the data there instead. I would like to know how this can be done, is there a way to do this in the model so that it selects database to save based on logged in user's role?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mXTigj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire