Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent

I have the following model.

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class User extends Model {

    use SoftDeletes;

    protected $table = 'users';
    protected $fillable = [
        'user_name', 'created_at', 'created_by', 'updated_at', 'updated_by', 'deleted_at'
    ];

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

        // This works and updates my updated_by column        
        User::updating(function($user)  {
            $user->updated_by = 1;
        });
		
		// This is being ignored and does not update the updated_by column
        User::deleting(function($user)  {
            $user->updated_by = 1;
        });
    }
    
}

Since the delete is just a table update of the deleted_at column...why would this be ignored?

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

mikerh mikerh Joined 19 Nov 2014

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.

© 2025 Laravel.io - All rights reserved.