Hi i use laravel 10 with tenancy for laravel, i have two connection, and for my central database i use users model its fine with default connection, but for tenancy i use second connection to retrive data from server ( but not everytime , here i use both conn ) which second connection have the accounts table ( game database), and i want to make session from account. In reast everything is fine but i dont know how to change the providers model to switch from users to accounts..
I want to use for example in breeze auth package account model not users..
I did this but its work just if i make login ( succesfully ) but when i try to do logout ( just logout i tried ), he tried to select from users model.. So i'm sure i did something wrong.. or maybe everything is wrong
i change the config/auth and i created an middleware (declare in kernel.php for tenant group):
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'tenant' => [
'driver' => 'session',
'provider' => 'accounts',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'accounts' => [
'driver' => 'eloquent',
'model' => App\Models\Tenant\Account::class, // tenant model
],
],
class SwitchAuthModel
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
config(['auth.guards.web' => config('auth.guards.tenant')]);
return $next($request);
}
}
when i call /logout get method .. saw me this error select * from users where id = 11361 and users.deleted_at is null limit 1 he didnt execute my Auth::logout()..
Thanks in advance.