0

当用户重置他们的密码时,他们会被发送到我的仪表板。我需要将它们引导到其他地方,从我读过的内容中,我只需在我的 ResetPasswordController 中添加 RedirectTo,但这样做没有任何效果:

namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
   use ResetsPasswords;

   protected $redirectTo = '/checkcart';

  public function __construct()
  {
     $this->middleware('guest');
  }
}

更新以提供有关默认身份验证路由的路由信息

检查车路线:

Route::get('checkcart', 'CartController@checkcart');

密码重置路径由

Route::auth();

它具有默认值:

public function auth()
    {
    // 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')->name('password.request');
    $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
    $this->post('password/reset', 'Auth\ResetPasswordController@reset');
}
4

1 回答 1

1
use AuthenticatesUsers;

/**
 * Where to redirect users after login.
 *
 * @var string
 */
protected $redirectTo = '/home';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest', ['except' => 'logout']);
}

这是默认代码,您只需将 "$redirectTo= '/home' 更改为您想要的路线 - "$redirectTo = '/checkcart'

如果尚未解决,我将需要更多信息,例如如何定义路由以检测问题

于 2017-04-25T01:36:42.513 回答