title: Dispatching an event in Laravel 5 on model created
body: <p>I wan to create a Laravel signup system where I would send an email to verify the email once a user has signed up. I tried adding an event dispatched to the created method but I got an error </p>
  
  <pre><code> Fatal error: Non-static method Illuminate\Contracts\Events\Dispatcher::fire() cannot be called statically
  </code></pre>
  
  <p>Here is what I came up with. </p>
  
  <pre><code>  &lt;?php
  
  namespace App;
  
  use Laravel\Cashier\Billable;
  use Laravel\Spark\Teams\CanJoinTeams;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Foundation\Auth\User as BaseUser;
  use Laravel\Spark\Auth\TwoFactor\Authenticatable as TwoFactorAuthenticatable;
  use Illuminate\Contracts\Events\Dispatcher as EventDispatcher; 
  use Laravel\Spark\Contracts\Auth\TwoFactor\Authenticatable as TwoFactorAuthenticatableContract;
  
  class User extends BaseUser implements TwoFactorAuthenticatableContract
  {
      use Billable, TwoFactorAuthenticatable,CanJoinTeams;
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'email',
          'name',
          'password',
      ];
  
      /**
       * The accessors to append to the model's array form.
       *
       * @var array
       */
      protected $appends = [
  
      ];
  
  
      /**
       * The attributes excluded from the model's JSON form.
       *
       * @var array
       */
      protected $hidden = [
          'card_brand',
          'card_last_four',
          'extra_billing_info',
          'password',
          'remember_token',
          'stripe_id',
          'stripe_subscription'       
      ];
  
      /**
       * Boot the model.
       *
       * @return void
       */
      public static function boot()
      {
          parent::boot();
  
          static::creating(function ($user) {
              $user-&gt;token = str_random(30);
          });
  
          static::created(function ( $user) {        
  
             EventDispatcher::fire('UserCreated');   
  
          });
      }
  
  
      /**
       * Confirm the user.
       *
       * @return void
       */
      public function confirmEmail()
      {
          $this-&gt;verified = true;
          $this-&gt;token = null;
  
          $this-&gt;save();
      }    
  
  }
  </code></pre>
  
  <p>I also tried changing the code to </p>
  
  <pre><code>  use Billable, TwoFactorAuthenticatable,CanJoinTeams, EventDispatcher;
  </code></pre>
  
  <p>and replacing the boot part with </p>
  
  <pre><code> static::created(function ( $user, EventDispatcher $event) {        
  
         $event-&gt;fire('UserCreated');   
  
      });
  </code></pre>
  
  <p>But it gave me another error </p>
  
  <pre><code>App\User cannot use Illuminate\Contracts\Events\Dispatcher - it is not a trait
  </code></pre>
  
  <p>How do I fire the event once the model has been created ?</p>