Laravel 5: Krlove method does not exist

Viewed 1927

I installed Krlove Model generator on a project, I did every step to install it. However when I run this command:

php artisan krlove:generate:model Role --table-name=roles

It throws this error:

[ReflectionException]
Method Krlove\EloquentModelGenerator\Command\GenerateModelCommand::handle()
does not exist

I ran composer require krlove/eloquent-model-generator --dev and then I registered the service at config/app.php: Krlove\EloquentModelGenerator\Provider\GeneratorServiceProvider::class,

But it still doesn't work, if I'm missing a step please let me know, thanks in advance.

2 Answers

It is because you're running your app in a different ENV than dev.

This package will be installed only on a dev env when you run:

composer require krlove/eloquent-model-generator --dev

php artisan krlove:generate:model --connection=mysql_xxxx Role --table-name=roles

Try to specify the database connection to try, I have multiple databases, he did not go to the default database, I specify the database connection will be OK, this is my solution, for reference

Related