Maybe you are missing the session generation itself. attempt tries to authenticate but only that. If you see the manual authenticate example in Laravel Documentation a call to $request->session()->regenerate(); must be done after successfully attempt.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/**
* Handle an authentication attempt.
*/
public function authenticate(Request $request): RedirectResponse
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('dashboard');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
])->onlyInput('email');
}
}
When you install a new Laravel from scratch you can se how they give you the AuthenticatedSessionController with this method:
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(route('dashboard', absolute: false));
}
The attempt call is on the authenticate() method, if that success then $request->session()->regenerate() is called to create the session