Borut Flis
Borut Flis

Reputation: 16395

Trouble creating my first Laravel controller

I just started using and watched a youtube video how to start.

I try to make my first controller, so I execute this command:

php artisan controller:make WelcomeController

I get an exception:

  [InvalidArgumentException]                                    
  There are no commands defined in the "controller" namespace. 

I am executing this in the root folder of the Laravel project.

Upvotes: 1

Views: 80

Answers (1)

Bogdan
Bogdan

Reputation: 44536

The command is actually:

php artisan make:controller WelcomeController

You wrote controller:make instead of make:controller.


In the future you can run just php artisan and it will list all commands with a short description for each one, that way you can make sure you're running the correct command. If you want more details about a command, like usage and what options it accepts, you can run php artisan help [command]. So for your command it would be:

php artisan help make:controller

Upvotes: 1

Related Questions