Mohamed Said published a new video on the Laravel Youtube channel outlining 5 tips for dealing with Laravel's Service Container:
To sum up the tips:
- Avoid executing DB queries in service providers
- Avoid reading session data in service providers
- Avoid resolving bindings in the register method
- Scoped instances vs. Singletons
- Use rebinding events to refresh dependencies
Filed in: