Controller :: discovery () undefined in Laravel 4

I get an error when trying to register all controller routes in Laravel 4 (Illuminate), adding:

Route::controller(Controller::detect()); 

to my routes.php

Mistake:

 Error: Call to undefined method Illuminate\Routing\Controllers\Controller::detect() in C:\wamp\www\travless\app\routes.php line 13 

I assume they changed the name of the function, but I don’t know where to find it, because it is still an alpha version and I don’t know the documentation.

+7
source share
2 answers

This feature was removed in Laravel 4 due to inconsistent behavior with different file systems. The correct way to register controllers should be to explicitly define each of them that you want to use in the routes file.

+17
source

You need to register each controller manually in the routes.php file

 Route::controller('users', 'UsersController'); 

The first parameters are the URL to respond, the second is the controller class name

0
source

All Articles