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

leosvale's avatar

After logoff database adds a number "1" to the username

I have this weird situation that everytime I shut the session the username "gains" a number "1". Yeap! That's weird.

For example: My username is "admin", everytime I do end a section, the database rename my username to "admin1" and so on (now it's "admin111111"). And stays like this. So the next time I'll login i have to type my credential like this: username: admin1111111 - password: defaultpassword.

I'm not sure if I explained this issue correctly but I guess someone went though this weird thing?

0 likes
8 replies
Sinnbeck's avatar

Never heard of anything like that. Is the code public on github so we can inspect it? If not, try seaching for all instances of ->username or 'user_name' to see if you can find any place where its updating it

leosvale's avatar

@Sinnbeck I'll try that. Unfortunately is not available publicly, but I really appreciatte your answer!

cwhite's avatar

@leosvale,

If your username is not what you expect, then you know someone else logged in as you! ;)

leosvale's avatar

@cwhite not in this case. I'm the only one who has access to it. The username add a number "1" everytime I shut the session, it's instantly.

Tray2's avatar

Sounds to me like you have a

$user->update();

or a

$user->save();

Where you shouldn't

psrz's avatar

On your User model:

    protected static function booted()
    {

        static::saving(function ($user) {
            $e = new \Exception('Y U CHANGING !');
            report($e);;
        });
    }

Check the logs. You'll get the full stacktrace and maybe you can see where that update() or save() on the model is being called. Maybe you can add some info on the request too....

Please or to participate in this conversation.