tenancy / docs

@tenancy documentation markdown files and index.
13 stars 95 forks source link

Password reset table on tenant database #25

Open bkintanar opened 6 years ago

bkintanar commented 6 years ago

Moved from hyn/multi-tenant#443

It's possible to force the password reset entries to be saved on the tenant connection. In order to do so update the auth.php file and add the connection key like this:

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'connection' => 'tenant',
        ],
    ],
Nowi5 commented 6 years ago

Can you please give a bit more guidance? If I'm not wrong a hyn/multi-tenant application has 3 different connections: default (mysql), system and tenant.

When I run the auth() pages without setting the connection to tenant or system in auth.php, he can't find the users table. Should be the system and the default system be the same to avoid such behavior, or should we set the default connection always to system? How to do so?

Thank you.

bkintanar commented 6 years ago

@Nowi5 this package only suggest 2 database connection. System and Tenant db connection. Where is your users table located?

Nowi5 commented 6 years ago

Yes this package add this two connection on top of laravel standard. So can't we merge system with laravel standard?

luceos commented 6 years ago

You can, it's up to you, most often it makes sense to set default to system.

drbornot commented 3 years ago

And in the case of multiples User models? This solution works as well? I mean, if I have system and tenant users using different guards and providers form them

sniper7kills commented 3 years ago

I have 0 experience with tenancy/multi-tenant;

But in some experiments I did with multi-model authentication I came up with the following package. https://github.com/sniper7kills/multimodelauth

I can't promise it'll be a solution, or event help in this case, but it allowed me to have two different models, on two different connections, use a single guard for authentication. (in fact you'll likely just want to use that repo as an example, and implement a well tested solution in your own project)