So . . . apparently a mass delete does not trigger the events of individual deletes.
This code works:
static::deleting(function($video)
{
foreach($video->files as $file) {
$file->delete();
}
if(is_dir(public_path() . '/uploads/video_' . $video->id)) {
rmdir(public_path() . '/uploads/video_' . $video->id);
}
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community