0

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';
1
  • session()->replace('app.users')[$userIndex]['phones']['mobile'] = '12345678'; Commented Aug 30, 2017 at 10:22

1 Answer 1

1

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';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.