Use the nullOrDelete() method in your relationship column definitions to clear their value when the parent record gets deleted
- ·
- Telegram
- ·
- Newsletter
🔥#Laravel Migration tip🔥
Do you have a relationship that is nullable?
You can use the nullOnDelete() function. It achieves ON DELETE SET NULL behavior: