如何更改laravel 5.5中的注册链接?

时间:2017-11-13 16:25:58

标签: laravel laravel-5.5

我想将注册链接更改为domain.com/register?ref=abc 如何在laravel 5.5中做到这一点?

<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="{{ route('login') }}" class=""><i class="fa fa-sign-in"></i> Log In</a>
                        &nbsp;&nbsp;&nbsp;<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="{{ route('register') }}" class=""><i class="fa fa-user-plus"></i> Registration</a>

1 个答案:

答案 0 :(得分:1)

1。高估默认的auth路由:

您可以通过点击routes/web.php并根据需要更改默认身份验证路由来覆盖默认身份验证路由:

{
    // Authentication Routes...
    $this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
    $this->post('login', 'Auth\LoginController@login');
    $this->post('logout', 'Auth\LoginController@logout')->name('logout');

    // Registration Routes...
    $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
    $this->post('register', 'Auth\RegisterController@register');

    // Password Reset Routes...
    $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
    $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
    $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
    $this->post('password/reset', 'Auth\ResetPasswordController@reset');
}

2。直接在html锚标记上更改它:

您可以省略named routes并使用直接链接:

<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="http://example.com/register?ref=abc" class=""><i class="fa fa-user-plus"></i> Registration</a>

OR

<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="{{ route('register') }}/?ref=abc" class=""><i class="fa fa-user-plus"></i> Registration</a>

希望有所帮助