0

I am using Voyager plugin to do BREAD , it work great but i got 1 problem where i need enable soft delete. It also work great but i want to delete my data in show deleted and media file related to it . anyone have idea on how to do this

Atf Azi
  • 27
  • 6

1 Answers1

0

You can use eloquent deleted event for any post delete action

    public static function boot()
    {
        parent::boot();

        self::deleted(function($model){
            Storage::delete($model->file_name);
        });
    }

You can also make it reusable by defining the event action in a boot eloquent model trait

wpsiew
  • 191
  • 1
  • 4