1)policy (primary key)
2)project_declaration (foreign key for policy)
3)endorsement (foreign key for policy)
when I delete a record in the policy table. The other records which are link to that table are not deleting.
I am using onDelete('cascade) and I am using soft delete in all 3 tables.
onDelete('cascade) work on Sql level of your application and Sql level knows nothing about soft deletes.
onDelete trigger at sql level will fire only on actual removing record from the table.
If you want to use soft deletes and make cascade deleting you have to subscribe on model deletingevent
@matheenulla
How many records will be deleted at the same time, what do you think?
Cascade soft deleting on php level of application will take some time so if there are lots records to delete your users will wait for a response for some time or - which is worse - processing of the request will overlap max execution time and your web server will kill a process.
If you have about 100 records to delete per time there is no problem to use events and listeners. If you have about 100000 records to delete - you should use queues.
@martal ok thank bro for helping. I may delete not more than 10 records so I will go through the events and listeners. So I am seeing the documentation now. I will try that one now If I got some errors I will let you know thank you once again