I would like to get HTML data using an interfaced method like a Request. If anyone knows please explain me.
I would like to get output like this one! please help to write a sample Request php interface.
My real scenario is I have a controller that controller has a function Create. create function passed a parameter as a Request class. I want access to HTML input as I mentioned in the question. That is my problem.
<input name="inputname">
<input name="anotherinputname">
public function create(Request $request) {
echo $request->inputname;
echo $request->anotherinputname;
}
So please help to make Request class. Thanks
2
Answers
It’s not working as you think.
Laravel uses dependency injection.
You can define a Request class and in its constructor, you can map the POST data to properties.
something like this:
and then you can access the POST data this way:
Assuming you have this method in your controller:
You should grab your variables by doing: