Search code examples
phplaravel-5.1lumen

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


I use Lumen 1.0 for an API project.

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

$app->withEloquent();

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

php artisan make:model Book --migration

Error message :

  [InvalidArgumentException]
  Command "make:model" is not defined.
  Did you mean one of these?
      make:seeder
      make:migration

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.*)

Solution

  • 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!