Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lay's avatar
Level 1

I have a problem with login logout with laravel 12.30

I started a new project and successfully created a database, but the problem is that when I login and logout, it doesn't logout. The other problem is that I can't login either if I don't checkbox remember me. I solved this problem by setting it to "true". I really need help. The last version I used was 12.21.0, I enjoyed it, but this is 12.30, which has so many changes that it's giving me a headache. Or maybe I'm doing something important wrong. Anyway, thanks for your help. Here's all the code I think is relevant.

// route/web.php
<?php

use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

use App\Http\Controllers\LiveScoreController;

Route::get('/', function () {
    return Inertia::render('home');
})->name('home');

route::prefix('match')->name('match.')->group(function(){
    Route::get('history', function () {
        return Inertia::render('historyMatch');
    })->name('history');
});

// show upload
Route::get('flag', [LiveScoreController:: class, 'showFlag'])->name('flag');

require __DIR__.'/api.php';
require __DIR__.'/settings.php';
require __DIR__.'/auth.php';
require __DIR__.'/dashboard.php';

If you think there are other related files, you can tell me immediately, I will send it.

0 likes
5 replies
Tray2's avatar

Are you using any of the starter kits provided by Laravel?

2 likes
lay's avatar
Level 1

Yes, I use react. When I create my project I select react > laravel > PHPUnit.

lay's avatar
Level 1

More info, I tried creating a new project and trying to log in or log out, and it works fine. I think it might be due to some code changes I made, but I'm not sure if my changes conflict with the original code.

1 like
Frostist's avatar

Yeah, was about to say if you used the default Laravel auth package it should work perfectly off the shelf. Did you maybe tweak any of the user caching stuff in the .env file?

Hope you come right!

1 like
lay's avatar
Level 1

Oh ok I found the problem. The problem is I'm using user id as char(36) but session user_id is bigInt which makes the session not save when logged in, lol. My bad. And the second problem is that I can't log out. I solved this problem earlier by adding StartSession in bootstrap.

$middleware->web(append: [
    HandleAppearance::class,
    HandleInertiaRequests::class,
    AddLinkHeadersForPreloadedAssets::class,
    StartSession::class, // <-- Add this line to enable session middleware
]);

Thanks to everyone who came to help me find the problem and solve it.

Please or to participate in this conversation.