laravel observer get old value

Solutions on MaxInterview for laravel observer get old value by the best coders in the world

showing results for - "laravel observer get old value"
Irene
26 Jul 2019
1$model->getOriginal('attribute')
Till
10 Apr 2019
1User::updating(function($user)
2{
3    if ($user->username != $user->getOriginal('username')) {
4        doSomething();
5    }
6
7    // If you need multiple attributes you may use:
8    // $originalAttributes = $user->getOriginal();
9    // $originalUsername = $originalAttributes['username']; 
10});