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

Reges's avatar
Level 1

Session object losing one column value

Hi all.

I have a login method on user controller that register the user object in the session with the code bellow:

        $request->session()->put('user', $user[0]);
        $request->session()->save();

And I can retrieve that object in a blade view with no problems, but the ID field of the user object becomes empty.

Some info that could be usefull:

  • all other columns works fine;
  • ID is the only integer column;
  • if I put the ID value alone in a session var still doesn't work as well;
  • if I put the ID value alone in a session var and converted to string, then it works.

Some of you faced this before? What am I doing wrong? If you need some more details, please let me know.

Thanks in advance for all support.

0 likes
0 replies

Please or to participate in this conversation.