title: Lumen: Using Eloquent in Lumen Project
body: <p>I'm using Eloquent for my Lumen Project, After uncommenting </p>
  
  <pre><code>$app-&gt;withEloquent();
  </code></pre>
  
  <p>in bootstrap/app.php file, I've created database/models folder in my project for Model classes. Whenever i add a class in database/models, and try to use it, it throws and class not found exception, but after running composer dump-autoload, the class is available for use. How can i automate this, like just add the class model in database/models and use it, like we do in Laravel.</p>
  
  <p>Here's my Model class.</p>
  
  <pre><code>&lt;?php namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Post extends Model{
  
      protected $table = 'posts';
  
      protected $fillable = array(
          'id',
          'p_id',
          'username',
          'title',
          'uri',
          'source',
          'points',
          'status',
          'language',
          'type',
      );
  }
  </code></pre>
  
  <p>Here's my controller where i'm trying to use this model.</p>
  
  <pre><code>&lt;?php namespace App\Http\Controllers;
  
  use App\Post;
  
  class ContentController extends BaseController{
      public function posts(Request $request){
          return Post::all();
      }
  }
  </code></pre>
  
  <p>and here's my composer.json file</p>
  
  <pre><code>{
      "name": "laravel/lumen",
      "description": "The Laravel Lumen Framework.",
      "keywords": ["framework", "laravel", "lumen"],
      "license": "MIT",
      "type": "project",
      "require": {
          "laravel/lumen-framework": "5.1.*",
          "vlucas/phpdotenv": "~1.0",
          "illuminate/mail": "5.1.*"
      },
      "require-dev": {
          "phpunit/phpunit": "~4.0",
          "fzaninotto/faker": "~1.0"
      },
      "autoload": {
          "psr-4": {
              "App\\": "app/"
          },
          "classmap": [
              "database/",
              "database/models"
          ]
      },
      "autoload-dev": {
          "classmap": [
              "tests/"
          ]
      },
      "config": {
          "preferred-install": "dist"
      }
  }
  </code></pre>