overtrue / laravel-like

👍 User-like features for Laravel Application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I delete if likable_type or likable_id doesn't exist

ShekhSaifuddin007 opened this issue · comments

Here you can see my discussions table I deleted some discussion

discussion

and my likes table still have their type and id but I want that when I delete any discussion It will automatically delete the record from likes table how can I do that.?

likes

Sorry, polymorphic associations can't be deleted by association.

You can listen the Model::deleted event and delete the relations.

Yeah Thank you problem solved.