cybercog / laravel-love

Add Social Reactions to Laravel Eloquent Models. It lets people express how they feel about the content. Fully customizable Weighted Reaction System & Reaction Type System with Like, Dislike and any other custom emotion types. Do you react?
https://komarev.com/sources/laravel-love
MIT License
1.16k stars 72 forks source link

Unknown column 'reacted_by' in 'where clause' #254

Closed salvatormundiz closed 7 months ago

salvatormundiz commented 11 months ago

I working with V9 laravel-love! my User model use as Reacterable and Reactable! when I use this line:

$user=User::find(6);
        $myTherapist = User::query()
            ->whereReactedBy($user)
            ->get();
        dd($myTherapist);

my response is:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'reacted_by' in 'where clause'
antonkomarev commented 11 months ago

@salvatormundiz did you added Reactable trait to User model?

https://laravel-love.readme.io/docs/setup-reactable

salvatormundiz commented 11 months ago

It is my User model I want user can bookmark other user so use both:

use Cog\Contracts\Love\Reacterable\Models\Reacterable as ReacterableInterface;
use Cog\Laravel\Love\Reacterable\Models\Traits\Reacterable;
use Cog\Contracts\Love\Reactable\Models\Reactable as ReactableInterface;
use Cog\Laravel\Love\Reactable\Models\Traits\Reactable;
class User extends Authenticatable implements ReacterableInterface,ReactableInterface
{
    use HasApiTokens, HasFactory, Notifiable,HasRoles,Reacterable,Reactable;
antonkomarev commented 11 months ago

@salvatormundiz I forgot to add to the documentation query scopes.

antonkomarev commented 7 months ago

@salvatormundiz I've described setup process in following pages:

And updated usage pages:

Thanks for pointing this issue!