How to get the key from a laravel form request?
I have an array
array:2 [▼ 2 => "12" 7 => "12" ] Submit from the form, I need 2 and 7, what do I call them?
Keys are identifiers of the parts that want it that way. foreach get id and value then update something ...
foreach($request->except('_token') as $part) { /*get Key here (in this case 2 or 7) and get value here (in this case both 12)*/ } Can someone tell me how to do this?
Thanks in advance.
If you want to access only one key $request , you can use:
$request->key_name to achieve this goal.
example
I sent the image in the postman like this: 
And I got this in a Laravel controller as follows:
public function store(SendMessageRequest $request) { $image = $request->image; // this is what You need :) // ... }