コード例 #1
0
 protected static function boot()
 {
     parent::boot();
     Activity::deleting(function ($activity) {
         foreach ($activity->tasks as $task) {
             $task->delete();
         }
     });
     Activity::restored(function ($activity) {
         foreach ($activity->tasks as $task) {
             $task->restore();
         }
     });
 }