title: how to call Laravel 8.x Model
body: <p>I am new to laravel, I just installed it and used migrations files to create the database successfuly. Next step is to use the models. I need to use eloquent just as an ORM, I do not need to include the whole MVC stuff because I need to call the models from an outside project.
  So my model is</p>
  <pre><code>
  &lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Factories\HasFactory;
  use Illuminate\Database\Eloquent\Model;
  
  class Users extends Model
  {
      use HasFactory;
  
       protected $fillable = [
           'name',
           'users_username',
           'email',
           'password',
       ];
      protected $table = 'users';
      protected $primaryKey = 'users_id';
  }
  ?&gt; 
  </code></pre>
  <p>And I am calling it from a test.php file in the root</p>
  <pre><code>
  &lt;?php
  require 'vendor/autoload.php';
  
  use App\Models\Users;
  
  $users = Users::where('users_username', 'adriana')
      -&gt;orderBy('users_username')
      -&gt;take(10)
      -&gt;get();
  
  print_r(Users::all() );
  ?&gt;
  </code></pre>
  <p>Simply calling &quot;php test.php&quot; from the command line, both statements give an error such as:</p>
  <pre><code>
  PHP Fatal error:  Uncaught Error: Call to a member function connection() on null in /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1493
  Stack trace:
  #0 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1459): Illuminate\Database\Eloquent\Model::resolveConnection()
  #1 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1266): Illuminate\Database\Eloquent\Model-&gt;getConnection()
  #2 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1183): Illuminate\Database\Eloquent\Model-&gt;newBaseQueryBuilder()
  #3 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1219): Illuminate\Database\Eloquent\Model-&gt;newModelQuery()
  #4 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1172): Illuminate\Database\Eloquent\Model-&gt;newQueryWithoutScopes()
  #5 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1885): Illuminate\Database\Eloquent\Model-&gt;newQuery()
  #6 /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1897): Illuminate\Database\Eloquent\Model-&gt;__call()
  #7 /var/www/html/orm/laravel-8.x/test.php(16): Illuminate\Database\Eloquent\Model::__callStatic()
  #8 {main}
    thrown in /var/www/html/orm/laravel-8.x/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 1493
  </code></pre>
  <p>I also inserted some data in the database as I thought that was the problem yet it still doesn't work
  I don't know what I should add to the model or to test.php
  How can I fix it in order to simply call this model?
  I have read and searched and I can't seem to find out how to fix it, how to use Models, all tutorials seem simple and clear yet nothing I tried worked.
  Thanks for your help</p>