用户在Laravel 7中首次注册后如何重定向到动态路由

时间:2020-10-14 10:41:57

标签: laravel-7

我是Laravel的新手,并且使用Laravel 7,我想问一个问题,当新用户首次注册时,验证电子邮件会发送到他/她的收件箱,并且当他验证时,必须重定向到路由例如修改个人资料页面以完成注册过程...

route('user/ . $user->id . / edit');

我不确定是否应该编辑此页面,如果要怎么编辑?因为它重定向到了首页

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;

class VerificationController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Email Verification Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling email verification for any
    | user that recently registered with the application. Emails may also
    | be re-sent if the user didn't receive the original email message.
    |
    */

    use VerifiesEmails;

    /**
     * Where to redirect users after verification.
     *
     * @var string
     */
    protected $redirectTo = RouteServiceProvider::HOME;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
        $this->middleware('signed')->only('verify');
        $this->middleware('throttle:6,1')->only('verify', 'resend');
    }
}

1 个答案:

答案 0 :(得分:0)

您可以从app/Providers/RouteServiceProvider.php进行更改:

public const HOME = '/home';

public const HOME = '/dashboard';

然后它将把您带到/dashboard