2

I have read Soft Delete Cascading with Laravel 5.2 ... now I am thinking that the information about the relation is already covered in the belongsTo().

Did anybody already create an automatism to check during deletion if any of the relations are touched and

either

a) delete those (DELETE CASCADE emulation) b) throw an exception (DELETE RESTRICT emulation)

Otherwise let's create one :-)

Question concerning this:

  • How can all the foreign relations of a model be queried
Alex
  • 32,506
  • 16
  • 106
  • 171

1 Answers1

1

I just did dd($user) and found:

  #relations: array:3 [▼
    "company" => Company {#803 ▶}
    "roles" => Collection {#829 ▶}
    "extendedPermissions" => Collection {#830 ▶}
  ]

There you have the relations. I guess you could cascade the delete using this data.

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180