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

Tags: , ,

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


Route::get('mdpay/template', array("uses" => "templateController@index"));


class templateController extends BaseController {

  public function index()
    echo "made it";


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:


// File Name: TemplateController.php
class TemplateController extends BaseController {
    public function index()
        // app/views/myView.blade.php
        echo "hello";

My route is:

Route::get('mdpay/template', array("uses" => "TemplateController@index"));

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


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.

Source: stackoverflow