Home » Php » Lumen (Laravel) Eloquent php artisan make:model not defined

Lumen (Laravel) Eloquent php artisan make:model not defined

Posted by: admin April 23, 2020 Leave a comment


I use Lumen 1.0 for an API project.

I have already enable Eloquent by uncomment the following line in bootstrap/app.php file :


But when I want to create my first model with migration it fails :

php artisan make:model Book --migration

Error message :

  Command "make:model" is not defined.
  Did you mean one of these?

Laravel doc about Eloquent (http://laravel.com/docs/5.1/eloquent#defining-models).

Lumen doc (http://lumen.laravel.com/docs/installation) doesn’t include Eloquent doc because, it’s not enable by default.

Do you have any ideas to avoid this error ?

Add details

php artisan --version

Displays :

Laravel Framework version Lumen (5.1.6) (Laravel Components 5.1.*)
How to&Answers:

You’re seeing this error because Lumen doesn’t come with make:model.

To see a list of all the artisan commands you have at your disposal just run php artisan.

That being said I did just find this package which I’ve added to a lumen installation and it seems to work fine https://github.com/webNeat/lumen-generators#installation

Hope this helps!


  1. Go to the project directory and add the generators package to your composer.json using the following command:

    composer require wn/lumen-generators
  2. Add following code segment to app/Providers/AppServiceProvider.php:

    public function register()
        if ($this->app->environment() == 'local') {
  3. Make sure that you have un-commented the following line in bootstrap/app.php to allow service providers on your project:

  4. Run php artisan list on the project directory (document root). Now you will see new items there.


just create your model file manually in the app directory


namespace App;
use Illuminate\Database\Eloquent\Model;

class Article extends Model {
    protected $table = ‘articles’;

    protected $fillable = [


If you check all the available commands using php artisan list you will see that you don’t have all the default ones offered by laravel. But you can get the most importants using the lumen-generator package (not to be confused with lumen-generators). It has the advantage of offering more commands than the other one mentioned.

To use it just install it using composer:

composer require flipbox/lumen-generator

Then enable it in your bootstrap/app.php file:


You will now be able to use all these new commands using artisan:

key:generate      Set the application key

make:command      Create a new Artisan command
make:controller   Create a new controller class
make:event        Create a new event class
make:job          Create a new job class
make:listener     Create a new event listener class
make:mail         Create a new email class
make:middleware   Create a new middleware class
make:migration    Create a new migration file
make:model        Create a new Eloquent model class
make:policy       Create a new policy class
make:provider     Create a new service provider class
make:seeder       Create a new seeder class
make:test         Create a new test class

Just have a look at the official documentation: https://github.com/flipboxstudio/lumen-generator