-
Notifications
You must be signed in to change notification settings - Fork 790
Description
Since #113 got rejected I'm opening this issue to discuss a potential addition to change database connections.
Passport currently uses the default database connection configured in the database.php config file.
This doesn't work for my use case. I have 2 applications 1 for all the front-end stuff ie. issuing tokens displaying the authorization screen etc. the second is purely an API. The default connection for these applications are different, therefore when using passport the authorization process will break because passport can't reach my oauth tables in 1 of the two applications.
I use this setup to separate my database tables across different databases and to separate my application logic to keep things flexible.
To support these kind of setups laravel/passport would require the database connection name to be configurable.
lucadegasperi/oauth2-server-laravel supports this by using the connection() method. It is possible to use the same method in laravel/passport, but it would become a bit messy when working with both eloquent model repositories and bridge repositories talking directly to the DB query builder.
I would suggest using either eloquent model repositories everywhere like #113 introduced or remove the eloquent model repositories altogether and used the bridge repositories primarily. Lastly we could use a static method to set the connection name during registration.
@taylorotwell I'm wondering if this fits the general idea of the package.
I'm open for suggestions.