Skip to content
Advertisement

Laravel Controller doesn’t exist, even though it clearly exists

The error I’m getting is that the controller doesn’t exist even though I know it does, here’s the code.

Route.php

JavaScript

templateController.blade.php

JavaScript

Why might I be getting this error: Class TemplateController does not exist

================= UPDATE: ==================

Ok, so I’ve created the correct route, renamed my file, and corrected the class name and I’m still coming up with that error.

File Names:

templateController.php

JavaScript

My route is:

JavaScript

Still receiving Controller Doesn’t Exist error. All my other controllers (3 others) are working except this one.

Advertisement

Answer

If you are using the standard composer classmap autoloader you need to composer dumpautoload everytime you create a new file.

So to create a new controller with the standard composer setup given by Laravel:

  1. Create a new file in app/controllers named TemplateController.php
  2. Open up terminal and run composer dumpautoload

As previous users have said, only view files should end with .blade.php.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement