rinvex / laravel-repositories

⚠️ [ABANDONED] Rinvex Repository is a simple, intuitive, and smart implementation of Active Repository with extremely flexible & granular caching system for Laravel, used to abstract the data layer, making applications more flexible to maintain.
https://rinvex.com
MIT License
666 stars 115 forks source link

Clear cache after model events #147

Closed iwex closed 7 years ago

iwex commented 7 years ago

Why not to add possibility of cache clearing after creating/updating/deleting eloquent model? Or, how can I write Unit tests with factory()->create()?

Omranic commented 7 years ago

Well, if I understood you well, then that's already implemented here.

iwex commented 7 years ago

@Omranic no, it only listens for https://github.com/rinvex/repository/blob/develop/src/Repositories/EloquentRepository.php#L198 events. So, should I create new models only through $repository->create()? Namely:

$entities = factory(App\User::class, 3)->make();
$entities->each(function (User $user) use ($repo) {
    $repo->create($user->toArray());
});
Omranic commented 7 years ago

Well, that's something outside the scope of this package then. Maybe you've to give the other package rinvex/cacheable a look which seems to be what you're looking for..