Reactant not exists.
laymont opened this issue · comments
First, sorry by me english..
I have the next problem:
public function like(Post $post) { $user = auth()->user(); $reacter = $user->viaLoveReacter(); if ($reacter->hasReactedTo($post, 'Like')) { $reacter->unreactTo($post, 'Like'); } else { $reacter->reactTo($post, 'Like'); } return back(); }
result this message:
Cog\Contracts\Love\Reactant\Exceptions\ReactantInvalid.
message: "Reactant not exists."
I followed the steps: Setup Reacterable & Setup Reactable. Help me please
Hi @laymont! This issue is the same as #168
All new reactable models registers as reactants automatically using observers, but if you are integrating package on already existing database you need to register your Reactable models as Reactants once. Just run console command:
php artisan love:register-reactants --model="App\Post"
More details in documentation:
@antonkomarev thanks