Displaying related data on form fields from deleted record.
Hello everyone, i just want to ask how do i display the data from related models on the form fields when a record is soft deleted. i just noticed that the data from other models doesnt exist anymore on the fields and i need to restore the record in order to display it again. thanks!
3 Replies
Hi @Jr. BE dev, can you share a bit of your form code? Just to show how you are using the relationship.
One way would be to to remove the soft deleting scope from the relationship itself, although that would probably have undesirable side effects ...
You might also try removing it from the modifyQueryUsing closure on the relationship() within Filament, like if using a group with a relationship ...
But really ... you might reconsider your use of soft deletes, if you are allowing soft deletion of data which is still required elsewhere. Implement your own 'status' mechanism, which allows setting a record to inactive, and use that to show/hide the record. When you find yourself fighting built in mechanisms like this, you're usually using the wrong approach.
good day, i finally fixed this issue the other day by the way. Yes you are correct i was not using the relationship of the models correctly to show related data. thank you!