Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Maybe if you do this

public function delete() {
    parent::delete();
    // ...
}
Last updated 2 years ago.
0

You need to use late static binding.

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

    Status::deleting(function($model)
    {
        $model->deleted_by = Auth::user()->id;
    });
}

You may also want to verify that someone is actually logged in, for cases like cron jobs, commands etc.

Last updated 2 years ago.
0

I figured it out, it seems that you can't append a value to the model when you are soft deleting it. Adding the ->save option did make it work.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.