kortsmit/likeable-functionality

getLikeCountAttribute in Likeable Trait return 0

dib258 opened this issue · 1 comments

Hi there,

First of all, nice work for this likeable functionnality project !

I was looking into it and in the Likeable Trait in the getLikeCountAttribute, the method always return 0.

return $this->likeableCounter ? $this->likeableCounter->count : 0;

I think it's because $this->likeableCounter exists nowhere.

I changed this line with the following one :

return $this->likes ? $this->likes->count() : 0;

I don't know if it's the best way but I don't understand how to fix this differently.

Thanks in advance for your answer !

Hey! Thanks for your interest. I had some fun with this for a few nights, but unfortunately never did finish it up. If I remember correctly, it was pretty close to functional, but still had some work remaining to get it all the way there.

If you do get it fully functional, feel more than free to open a PR! It'd be appreciated.