title: Class 'Role" not found [Symfony\Component\Debug\Exception\FatalErrorException]
body: <p>So I've seen a lot of similar questions asked about class not found errors but unless I'm totally missing somethings obvious, I just can't understand how the following method call does not see my role class and results in the class not found exception:</p>
  
  <pre><code> $user-&gt;makeEmployee("admin")
  </code></pre>
  
  <p>Here is my user class with makeEmployee():</p>
  
  <pre><code>&lt;?php namespace App;
  use Illuminate\Auth\Authenticatable;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Auth\Passwords\CanResetPassword;
  use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
  
  class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
  
  use Authenticatable, CanResetPassword;
  
  /**
   * The database table used by the model.
   *
   * @var string
   */
  protected $table = 'users';
  
  /**
   * The attributes that are mass assignable.
   *
   * @var array
   */
  protected $fillable = ['name', 'email', 'password'];
  
  /**
   * The attributes excluded from the model's JSON form.
   *
   * @var array
   */
  protected $hidden = ['password', 'remember_token'];
  
  
  /**
   * Get the roles a user has
   */
  public function roles()
  {
      return $this-&gt;belongsToMany('Role', 'users_roles');
  }
  
  /**
   * Find out if User is an employee, based on if has any roles
   *
   * @return boolean
   */
  public function isEmployee()
  {
      $roles = $this-&gt;roles-&gt;toArray();
      return !empty($roles);
  }
  
  /**
   * Find out if user has a specific role
   *
   * $return boolean
   */
  public function hasRole($check)
  {
      return in_array($check, array_fetch($this-&gt;roles-&gt;toArray(), 'name'));
  }
  
  /**
   * Get key in array with corresponding value
   *
   * @return int
   */
  private function getIdInArray($array, $term)
  {
      foreach ($array as $key =&gt; $value) {
          if ($value == $term) {
              return $key;
          }
      }
  
      throw new UnexpectedValueException;
  }
  
  /**
   * Add roles to user to make them a concierge
   */
  public function makeEmployee($title)
  {
      $assigned_roles = array();
  
      $roles = array_fetch(Role::all()-&gt;toArray(), 'name');
  
      switch ($title) {
          case 'admin':
              $assigned_roles[] = $this-&gt;getIdInArray($roles, 'create_message');
          /*case 'member':
              $assigned_roles[] = $this-&gt;getIdInArray($roles, 'create_customer');
          case 'concierge':
              $assigned_roles[] = $this-&gt;getIdInArray($roles, 'add_points');
              $assigned_roles[] = $this-&gt;getIdInArray($roles, 'redeem_points');*/
              break;
          default:
              throw new \Exception("The employee status entered does not exist");
      }
  
      $this-&gt;roles()-&gt;attach($assigned_roles);
  }
  }
  </code></pre>
  
  <p>And here is my Role class:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Role extends Model
  {
      protected $table = 'roles';
      /**
       * Set timestamps off
       */
      public $timestamps = false;
  
      /**
       * Get users with a certain role
       */
      public function users()
      {
          return $this-&gt;belongsToMany('User', 'users_roles');
      }
  }
  </code></pre>
  
  <p>If they are both is the same namespace can't I just use <code>Role</code> in <code>User</code>?
  I've also tried clear-compile and composer dump-auto as well as replacing the <code>Role</code> reference with <code>App\Role</code> and including <code>use App\Role</code> at the top. I'm using PHPStorm and it catches the reference fine as well as I am able to jump to the <code>Role</code> class definition from the user code. Thanks in advance for your help!</p>