Support the ongoing development of Laravel.io →
Session Eloquent

Alright so i was using a session earlier and encountered a weird "bug"?

so here is my original code that should had worked?

$tid = Session::get('tid');

$ticket = TicketUpdate::create(array(
'tid'		=>	$tid,
'uid'		=>	Auth::user()->id,
'message'	=>	$reply
));

I would get the error that "tid" was null, but simply adding this second line it works fine:

$tid = Session::get('tid');
$tid_value = $tid;   //<--- here
$ticket = TicketUpdate::create(array(
'tid'		=>	$tid_value,	
'uid'		=>	Auth::user()->id,
'message'	=>	$reply
));
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ud3webdev ud3webdev Joined 1 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.