0

I have built out a production API leveraging Laravel 5x (lets say api.test). I have gotten to the point now where I need to create a sandbox environment for users of the API to test out the API to without muddying up the live data (lets say sandbox.api.test)

I could obviously spin up an exact clone of my current production environment and keep everything separate auth, keys, etc.

Ideally I would want the authentication pieces of the sandbox to point at the production database so that users would not have to create new user accounts and separate oauth keys from passport.

What I am struggling with his how I could point anything authentication related so users/passport to my production environment and keep the rest of the DB actions local to sandbox.api.test

I know I can create a new connection in database.php but how then in my sandbox code do i update auth and oauth... is that even possible?

Citti

Citti
  • 423
  • 1
  • 6
  • 23
  • Yes, change the connection in your model like this https://stackoverflow.com/questions/52278456/laravel-change-connection-in-model-for-one-method . That should work – Hari Harker Apr 06 '19 at 20:17
  • This is not going to work for what I need.... I have actually been able to change the connection for the Passport piece from the directions here: https://laravel.com/docs/5.8/passport#overriding-default-models Now I need to figure out how to do this for my User model. Seems the User model is needed for me to make requests out to the "Live" server... – Citti Apr 10 '19 at 00:19

0 Answers0