Route::controllers in Laravel 5.3

依然范特西╮ 提交于 2019-12-12 03:53:34

问题


[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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!