In normal situation we get input fields values like $request->input('input_name') but in my case my input names are dynamic and can be anything (comes from database).
I want to know how can I get data of such inputs?
Code
my form input is like:
//1
<input type="radio" value="{{$opt->title}}" name="{{$opt->group->title}}">
//2
<select name="{{$opt->group->title}}" class="form-control">
//3
<input class="options-checkbox" type="checkbox" value="{{$opt->title}}" name="{{$opt->group->title}}[]">
so each of this inputs has different names based on database, and i can't predict their names in controller in order to get their values.
Test DD
array:5 [▼
"_token" => "QBY0WqF2WdqALxks22zjqpuBwplviHStBzTqzFzD"
"COLORS" => "blue" //1
"tester_group3ffhshg" => "title 33" //2
"radio_group" => array:1 [▼
0 => "hi" //3
]
"quantity" => "1"
]
Is there anyway to get data from such inputs?
$request->all()gives you all of these data.{{$opt->group->title}}the thing is this value is dynamic (can be anything) so i can't use$request->input('input_name')thisinput_namecan be anything$opt->group->titlevalue from database in the controller and then$request->only([$opt->group->title])will gives you correct value you want.