1

I use Laravel as tool for building RESTful application.

There is an end-point /settings/update that takes JSON of user settings.

I send to this address data in JSON format.

How to handle this data in Request $request?

So, I can not refer to property as: $request->notifications

1 Answer 1

2

When sent as JSON, the Request factory will allow you to access properties of that object.

Given a JSON object passed like this:

{ 
    "user" : {
         "settings" : {
             "some_setting" : {
                 "value" : 'My value'
             }
         }
    }

}

You can access the value using dot notation:

$request->input('user.settings.some_setting.value');
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.