首页 文章

Laravel 5.4.21默认验证链接不起作用

提问于
浏览
0

我正在关注此用户手册: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 回答

  • 0

    首先,运行$ php artisan make:auth .

    因为默认情况下,至少在5.4中,Laravel不包含身份验证路由和视图 . 运行该命令会生成它们 . 你会在Laravel Authentication Quickstart中看到它 .

  • 0

    好的,我自己解决了这个问题:

    我首先发出:

    $ vagrant box list
    

    要查找我下载的框,然后:

    $ vagrant box remove laravel/homestead
    

    然后我将家园从版本1.0.1升级到2.1.0:

    $ vagrant box add laravel/homestead
    

    我还使用以下方法升级了我的家园流浪者环境:

    $ git clone https://github.com/laravel/homestead.git Homestead2
    $ cd Homestead2
    $ git checkout v5.2.4
    

    在此之后,身份验证路由有效 .

相关问题