I
I
ildar-meyker2019-11-05 00:22:13
Laravel
ildar-meyker, 2019-11-05 00:22:13

Do I have to somehow soft delete the pivot table if I'm doing it on the models themselves?

Intuitively, as if it should. If yes, what is the best way to do it? Subscribe to events (they are guaranteed to work)? Transactions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Nikolaev, 2019-11-05
@ildar-meyker

No, if you are talking about money-mani. The pivot table just defines the relationship, and the relationship between soft-deleted entities does not need to be removed. You don’t need to hack anything, do as in the documentation and it will be right - fortunately, in Lara it is excellent.

V
Vasyl Fomin, 2019-11-05
@fomvasss

No, use a foreign key for the pivot table , and when the model is physically deleted from the database, records in the pivot will automatically be deleted too

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question