title: FatalErrorException in Model.php line 750: Class not found Laravel5
body: <p>I'm currently in the process of upgrading a Laravel 4.2 project to 5.0 I've been making reasonable progress until this particular error:</p>
  
  <p><strong>FatalErrorException in Model.php line 750: Class 'SAPProduct' not found.</strong></p>
  
  <p>My SapProduct class is called from my Product class with a hasOne relationship and I can't work out why Laravel can't find it.</p>
  
  <p>SapProduct.php</p>
  
  <pre><code>namespace App\Models;
  
  use Eloquent;
  
  class SapProduct extends Eloquent
  {
      public function brand()
      {
          return $this-&gt;belongsTo('App\Models\Brand', 'U_Brand', 'Name');
      }
  }
  </code></pre>
  
  <p>Product.php</p>
  
  <pre><code>namespace App\Models;
  
  use Eloquent;
  
  class Product extends Eloquent
  {
      ...
      public function sapProduct()
      {
          $relationship = $this-&gt;hasOne('App\Models\SapProduct', 'ItemCode', 'itemcode');
      }
      ...
  }
  </code></pre>
  
  <p>Model.php (lines 746-755)</p>
  
  <pre><code>public function hasOne($related, $foreignKey = null, $localKey = null)
  {
      $foreignKey = $foreignKey ?: $this-&gt;getForeignKey();
  
      $instance = new $related;
  
      $localKey = $localKey ?: $this-&gt;getKeyName();
  
      return new HasOne($instance-&gt;newQuery(), $this, $instance-&gt;getTable().'.'.$foreignKey, $localKey);
  }
  </code></pre>
  
  <p>I apologise if I'm missing any other necessary information, I'll add more as/if requested.</p>
  
  <p>Thanks</p>