laravel5.4 How do I return to the page before logging in after logging in? How do I maintain this state?
Please ask God for answers
3 answers
I don’t understand
laravel. Let’s talk about the idea of implementing this function without the framework under normal circumstances
You can get the current url when jumping to the landing page. When jumping to the landing page, splice it into a get parameter of the landing page, as shown below:

Then when submitting the login information, determine whether the url parameter has a value, and then jump to the page before login
You can follow the following steps to troubleshoot:
Check whether the
cookiein the logged inpostrequest carriessessioninformation;The
AuthControllerthat handles login requests has a fieldredirectPath, which represents the jump page after successful login. Check whether this value is correct;
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/**
* Handle an authentication attempt.
*
* @return Response
*/
public function authenticate()
{
if (Auth::attempt(['email' => $email, 'password' => $password])) {
return redirect()->intended('dashboard'); // 关键此处的intended
}
}
}
Hot tools Tags
Hot Questions
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
20417
7
13577
4






