vendredi 20 mai 2016

delete record related through two field

I have two models: model 1 field id, field_a, field_b

model 2 id2, field_a, field_b

on $model1->delete() I would like to delete also $model2 where field_a and field_b are the same of $model1 (both of them)

Example

model1
1, 2, 5

model2
1, 2, 4
2, 3, 5
3, 2, 5 (to be deleted)

I don't know if this could be helpful Automatically deleting related rows in Laravel (Eloquent ORM)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1qz7OKd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire