rtconner / laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a "like" or "favorite" or "remember" feature.
MIT License
401 stars 49 forks source link

Why is the likeable_like_counters table needed ? #16

Closed RomainSauvaire closed 8 years ago

RomainSauvaire commented 8 years ago

Hello Rob,

Thank you for your great work on this package. After testing it a little bit, I am wondering why this likeable_like_counters is needed and why you don't count directly the likeable_id + likeable_type key on the likeable_likes table directly. It should be pretty fast with indexes right ?

Except for performance reason on a huge data collection, I don't really see the point and I'm asking myself if I am missing something.

Thank you very much for your answer !

rtconner commented 8 years ago

Yeah it got really slow with larger sets of data. You aren't missing anything.

RomainSauvaire commented 8 years ago

Thank you @rtconner

BTW, do you have any plan on supporting the Relation::morphMap ?