The error I’m getting is that the controller doesn’t exist even though I know it does, here’s the code.
Route.php
Route::get('mdpay/template', array("uses" => "templateController@index"));
templateController.blade.php
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:
templateController.php
// 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.
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:
- Create a new file in
app/controllers
namedTemplateController.php
- Open up terminal and run
composer dumpautoload
As previous users have said, only view files should end with .blade.php
.