title: Call to a member function connection() on a non-object error on Laravel 5
body: <p>I want to store user configuration data on database and I'm following this forum thread about it <a href="http://forumsarchive.laravel.io/viewtopic.php?id=10406" rel="noreferrer">http://forumsarchive.laravel.io/viewtopic.php?id=10406</a>
  but when I implemented it laravel throws an error.
  I ran composer dump-autoload but nothing seems to be workign.What's the problem here?</p>
  
  <p>// filename: app/config/settings.php</p>
  
  <pre><code>use \App\Models\Setting
  
  $list = array();
  
  $format = function(&amp;$list, $keys, $val) use(&amp;$format) {
      $keys ? $format($list[array_shift($keys)], $keys, $val) : $list = $val;
  };
  
  foreach(Setting::all() as $setting) {
      $format($list, explode('.', $setting-&gt;token), $setting-&gt;content);
  }
  
  return $list;
  </code></pre>
  
  <p>Usage:</p>
  
  <p>echo Config::get('settings.token'); // returns value of 'content'</p>
  
  <p>Full error</p>
  
  <pre><code>Fatal error: Call to a member function connection() on a non-object in C:\wamp\www\iapp\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 3137
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0017  247544  {main}( )   ..\index.php:0
  2   0.0910  2848480 Illuminate\Foundation\Http\Kernel-&gt;handle( )    ..\index.php:58
  3   0.0910  2848736 Illuminate\Foundation\Http\Kernel-&gt;sendRequestThroughRouter( )  ..\Kernel.php:86
  4   0.0917  2886304 Illuminate\Foundation\Http\Kernel-&gt;bootstrap( ) ..\Kernel.php:110
  5   0.0917  2886472 Illuminate\Foundation\Application-&gt;bootstrapWith( ) ..\Kernel.php:215
  6   0.0974  2994336 Illuminate\Foundation\Bootstrap\LoadConfiguration-&gt;bootstrap( ) ..\Application.php:194
  7   0.0986  3025160 Illuminate\Foundation\Bootstrap\LoadConfiguration-&gt;loadConfigurationFiles( )    ..\LoadConfiguration.php:38
  8   0.1407  3814624 require( 'C:\wamp\www\iapp\config\settings.php' )   ..\LoadConfiguration.php:56
  9   0.1407  3814696 ConfigSetting::getSettings( )   ..\settings.php:28
  10  0.1494  4488840 Illuminate\Database\Eloquent\Model::all( )  ..\settings.php:16
  11  0.1496  4494520 Illuminate\Database\Eloquent\Model-&gt;newQuery( ) ..\Model.php:646
  12  0.1496  4494616 Illuminate\Database\Eloquent\Model-&gt;newQueryWithoutScopes( )    ..\Model.php:1769
  13  0.1496  4494688 Illuminate\Database\Eloquent\Model-&gt;newBaseQueryBuilder( )  ..\Model.php:1795
  14  0.1496  4494736 Illuminate\Database\Eloquent\Model-&gt;getConnection( )    ..\Model.php:1852
  15  0.1496  4494784 Illuminate\Database\Eloquent\Model::resolveConnection( )
  </code></pre>
  
  <p>Edit :</p>
  
  <blockquote>
    <p>
    
    <p>namespace App\Models;</p>
    
    <p>use Illuminate\Database\Eloquent\Model;</p>
    
    <p>class Setting extends Model {</p>
    
    <p>}</p>
  </blockquote>