public function login()
{
$login = EmployeeLogin::whereEmail(request()->email_id)->first();
if ($login) {
if($login->active == 1){
if (Auth::guard('employer')->attempt(['email' => request()->email_id, 'password' => request()->pwd]))
{
Auth::guard('employer')->user();
return redirect()->intended('/');
}
else{
return redirect()->route('employer.auth')->with('message','Incorrect Email id or Password');
}}}}
如何重定向回登录后输入的页面?
我们已经尝试过使用
redirect()->back()
return Redirect::route('dashboard');
和Redirect::intended('dashboard');
我正在使用laravel 5.4。
答案 0 :(得分:1)
使用intended()方法
return redirect()->intended('/');
来自docs
重定向器上的
intended
方法会将用户重定向到他们在被身份验证中间件拦截之前尝试访问的URL。如果目标目的地不可用,则可以为此方法提供回退URI。
答案 1 :(得分:0)
使用Redirect::to()
use Illuminate\Support\Facades\Redirect;
return Redirect::to('dashboard');
在 routes.php
中Route::get('/dashboard', 'Controller@method')->name('dashboard');