Curtis Weeks
Curtis Weeks

Reputation: 325

Why is artisan make:controller not making controllers?

$ artisan make:controller fooController
Controller created successfully.

A controller is not created under app\Http\Controllers and git status does not show any changes. Running the command a second time returns "Controller already exists!" artisan make:model Foo works fine as does creating a controller by hand, but that's not really fun. What am I missing?

    "php": ">=5.6.4",
    "laravel/framework": "5.4.*",

The workstation is Windows and there do not seem to be any permission problems.

Edit: Tried running composer update, same result.

Upvotes: 3

Views: 2993

Answers (1)

derrysan7
derrysan7

Reputation: 457

Rename your controller name using capital on the first letter:

artisan make:controller FooController 

Also, according to Laravel naming convention, you don't have to add Controller at the end of the controller name. Use this instead:

artisan make:controller Foo

make sure your controller name is in singular form

For Example:

php artisan make:model Supplier --migration --controller

will produce:

-Controller named: SupplierController.php

-Model named: Supplier.php

-Migrations named: 2017_06_17_161642_create_suppliers_table.php (laravel automatically change it into plural form)

Also, try checking your laravel version using: php artisan --version and make sure its 5.4.xx

if not, update your laravel using composer update

Upvotes: 2

Related Questions