delete with data that relationship
I have a form that have relationship (hasMany) to multiple participants.
How to make when deleting the form from table resource, is also remove the participants data to?
8 Replies
usually you define this using the foreign key in your database
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
->onDelete('cascade');
Thank you so much for your respond!
But sadly isn't working, I have 2 tables RootInformation and Participant.
At the RootInformation model already had this
at the Participant model
works fine when using repeater relationship. but now when want to delete data from RootRelationship table, the participant not follow to deleted.
how does your migration file look like?
RootInformation migration:
participants migration
@mvenghaus
does this work? .. shouldn't it be "root_information" .. can you see that the the foreign key is created properly in your db tool ?
because it's not filament or laravel model methods who delete's the data .. it's the database