I'm looking for a strategy for destroying Eloquent aggregates, e.g. models that "contain" other models.
In Ruby on Rails's ActiveRecord, there is a dependent: :destroy
option that can be placed when defining relations, meaning that if e.g. an order
is deleted, then the order_lines
must go too.
Is there something similar in Laravel? Or any other alternatives besides manually cleaning up and wrapping it in a transaction?