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

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!


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:

$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);

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


  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') {
            $this->app->register('Wn\Generators\CommandsServiceProvider');
        }
    }
    
  3. Make sure that you have un-commented the following line in bootstrap/app.php to allow service providers on your project:

    $app->register(App\Providers\AppServiceProvider::class);
    
  4. Run php artisan list on the project directory (document root). Now you will see new items there.