Reputation: 25
I want to insert my session variable value in the database. i have tried this code but its not working
$uid=$_SESSION['userid'];
$image->U_id = Input::get($uid);
what should i do?
Upvotes: 0
Views: 53
Reputation: 579
I don't know what your aim is to achieve with this, but you can also store the sessions in the database with very little configuration if that's what you're after, Laravel already supports this.
Upvotes: 0
Reputation: 26258
$_SESSION['userid'];
doesn't work in Laravel.
Try this:
$userid = Session::get('userid'); // this is the way to get laravel session value
// save it in database
Upvotes: 1
Reputation: 323
If you already have the variable stored in $uid
, there is no reason to call Input::get()
.
So just do something likes this.
$uid=$_SESSION['userid'];
$image = new Image;
$image->U_id = $uid;
$image->save();
Upvotes: 0