Reputation: 623
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
Upvotes: 1
Views: 508
Reputation: 50798
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');
Upvotes: 2