我正在关注此用户手册:https://laravel.com/docs/5.4/authentication为Laravel 5.4编写
我首先发布了一个新的Laravel应用程序:
$ laravel new mysite
在.env文件中,我更改了DB_DATABASE = mysite_db
然后我切换到/ Code / mysite目录并发出:
$ php artisan make:auth
$ php artisan migrate
当我指向http://mysite.app/register时,我收到消息:"Sorry, the page you are looking for could not be found." http://mysite.app/login也是一样的 . 我也试过http://mysite.app/auth/register .
为什么默认的身份验证路由不起作用?
routes / web.php读取:
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
2 回答
首先,运行$
php artisan make:auth
.因为默认情况下,至少在5.4中,Laravel不包含身份验证路由和视图 . 运行该命令会生成它们 . 你会在Laravel Authentication Quickstart中看到它 .
好的,我自己解决了这个问题:
我首先发出:
要查找我下载的框,然后:
然后我将家园从版本1.0.1升级到2.1.0:
我还使用以下方法升级了我的家园流浪者环境:
在此之后,身份验证路由有效 .