Closed Themesfa closed 6 years ago
You can solve your problem by using the Model's event: https://laravel.com/docs/5.6/eloquent#events
you mean i must remove user settings by create a listener and fire an event on delete a user to remove all setting related to it ?
Yes, something like this listener handled when deleting
a user.
I set a foreign key for
user_id
referencesid
onusers
with this code in migration file:i want to delete user settings when user deleted. but there is a problem with default settings that users_id is 0 . because user_id 0 is not exists in
users
table and it just a default value for normal settings and i get error when i want to set a normal setting . how i can fix that ? should i use a second table for normal settings and how i do that ?