Use the nullOrDelete() method in your relationship column definitions to clear their value when the parent record gets deleted

Use the nullOrDelete() method in your relationship column definitions to clear their value when the parent record gets deleted

🔥#Laravel Migration tip🔥

Do you have a relationship that is nullable?

You can use the nullOnDelete() function. It achieves ON DELETE SET NULL behavior:

We're writing a book, you can get it for free here.