title: Slim Framework and Eloquent ORM
body: <p>I'm using <code>Slim Framework</code> together with <code>Laravel's Eloquent ORM</code> and this is my code:</p>
  
  <p><strong>User.php</strong></p>
  
  <pre><code>class User extends \Illuminate\Database\Eloquent\Model
  {
      protected $table = 'accounts';
  }
  </code></pre>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>require_once 'vendor/autoload.php';
  
  // Models
  include 'app/models/User.php';
  
  $app = new \Slim\Slim();
  
  // Database information
  $settings = array(
      'driver' =&gt; 'mysql',
      'host' =&gt; '127.0.0.1',
      'database' =&gt; 'photo_mgmt',
      'username' =&gt; 'root',
      'password' =&gt; '',
      'collation' =&gt; 'utf8_general_ci',
      'prefix' =&gt; '',
      'charset'   =&gt; 'utf8',
  );
  
  $container = new Illuminate\Container\Container;
  $connFactory = new \Illuminate\Database\Connectors\ConnectionFactory($container);
  $conn = $connFactory-&gt;make($settings);
  $resolver = new \Illuminate\Database\ConnectionResolver();
  $resolver-&gt;addConnection('default', $conn);
  $resolver-&gt;setDefaultConnection('default');
  \Illuminate\Database\Eloquent\Model::setConnectionResolver($resolver);
  
  $app-&gt;get('/', function () use ($app) {
      $users = \User::all();
      echo $users-&gt;toJson();
  });
  
  $app-&gt;run();
  </code></pre>
  
  <p>As you can see in my code, I have to include the <code>User.php</code> file in my <code>index.php</code>. But what if I have multiple models? Can I just include a folder and all models will also be included so that it won't look messy including every model file in my index.</p>
  
  <p>Thank you in advance.</p>
  
  <p><strong>UPDATE:</strong>
  I'm using this piece of code I saw</p>
  
  <pre><code>foreach (glob("app/models/*.php") as $filename)
  {
      include $filename;
  }
  </code></pre>
  
  <p>Is there a cleaner looking way?</p>