hipsterjazzbo / Landlord

A simple, single database multi-tenancy solution for Laravel 5.2+
MIT License
614 stars 138 forks source link

Add ability to switch tenant on the fly in the queue #61

Closed TheDeadCode closed 7 years ago

TheDeadCode commented 7 years ago

If we ever use a booted model in the queue and we switch tenant afterwards, the tenancy is kept in place and will use the old tenant id. We need to find a way to re-boot the models.

TheDeadCode commented 7 years ago

For those who are curious, simply doing

\Illuminate\Database\Eloquent\Model::clearBootedModels(); should fix your queue by resetting all scopes.