登录laravel项目后如何更改/home

Fah*_*mal 2 frameworks laravel laravel-5

我是 Laravel 框架的新手。我在我的项目中安装了 Auth 类。因此,当我登录我的项目时,它会转到仪表板,但 url 是 ('/home')。我想更改此路径,登录后我希望它继续('/dashboard')。对于那些工作,我想更改哪个文件?我找到了 4 个文件,其中 /home 被清除。那就是 web.php、LoginController.php、HomeController.php、RedirectIfAuthenticated.php。我将更改哪个文件?或者还有更多文件吗?

web.php 文件

homeController.php 文件

loginController.php 文件

redirectIfAuthenticated.php 文件

rpm*_*192 5

现在在 Laravel 6.X 中有一种更简单的方法可以做到这一点。

只需更改app/Providers/RouteServiceProvider.php文件中的常量即可。

/**
  * The path to the "home" route for your application.
  *
  * @var string
  */
  public const HOME = '/new-url';
Run Code Online (Sandbox Code Playgroud)

之后,更改routes/web.php文件中的路由。

Route::get('/new-url', 'Controller@method');

// If you don't want to use the HomeController, be sure to include the auth middleware.
Route::get('/new-url', 'Controller@method')->middleware('auth');
Run Code Online (Sandbox Code Playgroud)

HomeController如果您不在路线中使用它,则可以删除它,不会造成任何问题。