I want to use interface methods like request to get HTML data. If anyone knows please explain.
I want to get output like this! Please help in writing a sample Request php interface.
My real scenario is that I have a controller that has a create function. The create function passes parameters as Request class. I want to access the HTML input as I mentioned in the question. This is my problem.
<input name="inputname"> <input name="anotherinputname">
public function create(Request $request) { echo $request->inputname; echo $request->anotherinputname; }
So please help make the Request class. Thanks
It doesn't work like you think. Laravel uses dependency injection. You can define a Request class and map POST data to properties in its constructor. Something like this:
You can then access the POST data via: