title: How to add model events to an event subscriber class in Laravel 5.1
body: <p>I would like to refactor some event so I've created an event subscriber class. </p>
  
  <pre><code>class UserEventListener
  {
      public function onUserLogin($event, $remember) {
  
          $event-&gt;user-&gt;last_login_at = Carbon::now();
  
          $event-&gt;user-&gt;save();
      }
  
      public function onUserCreating($event) {
           $event-&gt;user-&gt;token = str_random(30);
      }
  
      public function subscribe($events)
      {
        $events-&gt;listen(
          'auth.login',
          'App\Listeners\UserEventListener@onUserLogin'
         );
  
        $events-&gt;listen(
          'user.creating',
          'App\Listeners\UserEventListener@onUserCreating'
         );
      }
  }
  </code></pre>
  
  <p>I register the listener as follows:</p>
  
  <pre><code> protected $subscribe = [
      'App\Listeners\UserEventListener',
  ];
  </code></pre>
  
  <p>I added the following to the boot method of the user model as follows:</p>
  
  <pre><code>public static function boot()
  {
      parent::boot();
      static::creating(function ($user) {
         Event::fire('user.creating', $user);
      });
  }
  </code></pre>
  
  <p>But when I try the login I get following error:</p>
  
  <p><code>Indirect modification of overloaded property App\User::$user has no effect</code></p>
  
  <p>Whats wrong with the <code>onUserLogin</code> signature? I thought you can access user using $event->user...</p>