问题
[BadMethodCallException]
Method controllers does not exist.
Route::controllers(['auth' => 'Auth\AuthController', 'password' => 'Auth\PasswordController',]);
How is in Laravel 5.3?
Thanks
回答1:
The Route::controller() has been deprecated (notes can be seen in the upgrade from 5.2 -> 5.3 on the docs site)
Implicit controller routes using Route::controller have been deprecated. Please use explicit route registration in your routes file. This will likely be extracted into a package.
Instead you must explicitly list each route in not resourceful controllers like so:
Route::get('foo', 'FooController@foo');
If your question is aimed specifically at the auth routes only then as the comments on your question running php artisan make:auth
or adding Auth::routes();
to your routes\web.php file should do the trick.
回答2:
May few dependency cannot injected in your project when you install via composer. You can try again to install a new copy or write the following lines in your project directory using the terminal.
composer install
or you can write
composer dump-autoload
Hope you can fix the problem.
来源:https://stackoverflow.com/questions/41026713/routecontrollers-in-laravel-5-3