Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel check model column was changed

class UserObserver
{


    /**
     * Listen to the User created event.
     *
     * @param  AppUser  $user
     * @return void
     */
    public function updating(User $user)
    {
      if($user->isDirty('email')){
        // email has changed
        $new_email = $user->email; 
        $old_email = $user->getOriginal('email');
      }
    }

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #check #model #column #changed
ADD COMMENT
Topic
Name
4+7 =