Automatically deleting related rows in Laravel (Eloquent ORM)

When I delete a row using this syntax:

$user->delete();

Is there a way to attach a callback of sorts, so that it would e.g. do this automatically:

$this->photo()->delete();

Preferably inside the model-class.

19 Answers
19

Leave a Comment