【问题标题】:Laravel 5.3 Direct Home URI to Auth in Routes?Laravel 5.3 Direct Home URI to Auth in Routes?
【发布时间】:2016-11-24 04:45:16
【问题描述】:

Laravel 5.3 新手在这里。我想去localhost:8000php artisan make:auth生成的登录页面。

我的路线web.php 默认是这样的:

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index');

这当然会将它带到默认的 Laravel 欢迎页面。

我改成这样:

Route::get('/', function () {
    return view('home');
});

Auth::routes();

Route::get('/home', 'HomeController@index');

当没有进行身份验证时,仪表板会显示You are logged in!,所以这不起作用。

我把它改成这个,什么都没有加载:

Route::get('/', function () {
    Auth::routes();

    Route::get('/home', 'HomeController@index');
});

尝试了其他一些方法,但似乎没有任何效果。如果可能的话,还希望 URI 只是 localhost:8000 而不是 localhost:8000/login 或类似的东西。

有什么建议吗?

【问题讨论】:

    标签: php laravel authentication


    【解决方案1】:

    发布后大约 5 分钟,我意识到我需要这样做:

    Route::get('/', function () {
        return view('auth.login');
    });
    
    Auth::routes();
    
    Route::get('/home', 'HomeController@index');
    

    【讨论】:

      猜你喜欢
      • 2017-01-04
      • 2017-04-28
      • 2017-12-29
      • 1970-01-01
      • 2017-03-30
      • 2017-04-30
      • 1970-01-01
      • 2022-10-05
      • 2020-12-19
      相关资源
      最近更新 更多