Reputation: 4539
I have a session variable that contains a variety of json
objects and I want to be able to update these.
For example,
$userIndex = 123;
session()->get('app.users')[$userIndex]['phones']['landline'];
session()->get('app.users')[$userIndex]['phones']['mobile'];
How do I update the content value? How do I session put
a new mobile number?
session()->get('app.users')[$userIndex]['phones']['mobile'] = '12345678';
Upvotes: 0
Views: 551
Reputation: 104
If you need to put new session variable for laravel, it's important to use "put". You need to change "get" with "put".
For example:
session()->put('app.users')[$userIndex]['phones']['mobile'] = 'YOUR MOBILE NUMBER';
Upvotes: 1