bobD
bobD

Reputation: 1077

error while trying to run artisan command with Artisan Facade

here's the code

Route::get('run-cmd', function() {
    Artisan::call('make:controller HelloController');
});

and I wonder I'm getting this error...

InvalidArgumentException in Application.php line 549:
Command "make:controller HelloController" is not defined.
Did you mean one of these?
make:migration
make:controller
make:middleware
make:request
make:provider
make:console
make:event
make:model
make:command

what's wrong?

Upvotes: 1

Views: 1804

Answers (1)

Bahman Parsa Manesh
Bahman Parsa Manesh

Reputation: 2370

Replace

Artisan::call('make:controller HelloController');

with

Artisan::call('make:controller', [ 'name' => 'HelloController' ]);

Upvotes: 1

Related Questions