Laravel 8: Url Intended Not Working With Custom Login

After discussion in chat, what you're after cannot be done. Intended is not for returning someone who logged out long ago back to the same page they were on prior.

It's only useful for returning users back to the page they were accessing when the system found them logged out.

If they clicked log out and then next week arrived back to the site and logged in, it will not redirect them back to that page.

I would suggest storing the value when they log out against the users table if you wanted to achieve this.

public function logout(Request $request)
    {
        $previous = url()->previous('admin/dashboard');
        
        $request->user()->previous = $previous;
        $request->user()->save();

        $this->guard()->logout();
        //Usual logout code here

Then on login action you'd check if the user has that value in the column and redirect to it

if ($user->previous) {
    $redirect = $user->previous;
    $user->previous = null;
    $user->save();

    return redirect($redirect);
}
// Otherwise do the usual stuff

Create the DB Column with a new migration

Schema::table('users', function() {
    $table->string('previous')->nullable()->after('password');
}