sprocketbox/eloquence
Sprocketbox Eloquence is a Laravel package that extends Eloquent with reusable model traits and helpers, reducing boilerplate by adding common model behavior out of the box. It helps keep models consistent, maintainable, and easy to build.
php artisan about or by resolving IdentityManager from the container.IdentityManager class. The main entry point is the identity manager itself, which is typically injected into repositories, services, or controllers.IdentityManager, load the same record twice, and confirm both lookups return the same object instance (===). Then call IdentityManager::flushIdentities() and repeat the lookup to confirm a fresh instance is returned.flushIdentities() is the first lifecycle method to learn. Use it at the end of any request, job, or command that should not share identity state with the next unit of work.IdentityManager to your repositories or query services. The identity map keeps repeated lookups consistent within a single request.flushIdentities() in a finally block after each job. Long-running workers otherwise accumulate identity state across jobs, producing stale models or unexpected memory growth.terminate() method or an Octane request-terminated listener. This mirrors the package’s intent for flushIdentities().flushIdentities() in setUp() or tearDown() so identity state does not leak between test cases. Pair this with RefreshDatabase when using a database.Model::query()->update(), delete(), or raw DB::table() writes, flush the identity map. Direct database changes bypass the manager and leave cached identities stale.orchestra/testbench to match the Laravel version. Keep the package’s testbench constraint aligned with your application’s Laravel version when writing package-level or integration tests.DB::table(), another connection—can leave an old instance in memory. Flush after such operations.=== comparisons and object identity assumptions.flushIdentities() method is the primary defence against unbounded identity maps in queue workers, Octane, and long-running commands. Treat it as required lifecycle hygiene, not an optional cleanup.=== assertions to prove whether two lookups share an instance. If a model appears stale, flush first, then re-query before investigating deeper.flush() method there so workers and tests do not need to know about IdentityManager directly.How can I help you explore Laravel packages today?