You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work on a large multi-tenant application, and we have a whole bunch of simple services and repositories that we'd like to register as singletons in the container, but actually need to be scoped so that queue jobs clear them between different tenants.
I've modified our Application class so that in addition to looking for "bindings" and "singletons" properties (see https://laravel.com/docs/10.x/providers#the-bindings-and-singletons-properties), it also looks for a "scoped_singletons" property, so we can define all the simple scoped bindings in an array - I just thought it might be a helpful addition for other people as well?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I work on a large multi-tenant application, and we have a whole bunch of simple services and repositories that we'd like to register as singletons in the container, but actually need to be scoped so that queue jobs clear them between different tenants.
I've modified our Application class so that in addition to looking for "bindings" and "singletons" properties (see https://laravel.com/docs/10.x/providers#the-bindings-and-singletons-properties), it also looks for a "scoped_singletons" property, so we can define all the simple scoped bindings in an array - I just thought it might be a helpful addition for other people as well?
Beta Was this translation helpful? Give feedback.
All reactions