Skip to content
Advertisement

How do I delete everything related to user with the user account

I want to delete the user account as well as I want check if the user contains any 'posts', 'messages', 'friends' and if it does I want it to delete them as well.
I haven’t made any relations in their models.
I am having hard time develop this logic can anyone help me with it.

Here’s what I have done so far which dosen’t works:-

JavaScript

Advertisement

Answer

get() will give you an array, so delete() may not work after you use ->get.

Try this :

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement