kirkbushell / eloquence

A drop-in library for certain database functionality in Laravel, that allows for extra features that may never make it into the main project.
MIT License
543 stars 58 forks source link

Proposal: Model behaviours #14

Closed kirkbushell closed 9 years ago

kirkbushell commented 9 years ago

Something I've used in a few of my projects is additional behaviours for models. In Laravel 3, I write a basic soft-delete mechanism (back then it wasn't supported in Eloquent). This led to a behavioural system whereby developers could add behaviours for certain conditions (such as soft-delete, count caches and more).

I believe the time is now right to re-implement this behaviour for Eloquence (and Laravel 5). My first order of business would be a count cache.

Count caches in effect remove the need for joins on associated tables to count the records. A good example is a user hasMany posts - how many posts have they added?

I am wondering if anyone would be interested in just such behaviour as a part of Eloquence?

Let me know.

kirkbushell commented 9 years ago

This is now complete and running on the master branch. Release coming soon :)