What is the use of these steps in a PHP code. In my code I use to create a login page where username and passwords are inputs but I did not understand why the following step is used.
$input = Input::all();
Input::all()
gets all the fields from your form upon submit. So, your $input
variable will have array of fields from the form. eg: ['name'=>'John', 'email'=>'john@doe.com']
Inut::all()
is no longer used. Instead, you can use $request->all()
or Request::all()
Sorry If I repeated,Input::all()
is to accept all requested data, but is not a good way for login page. I recommend to use Request $request
in your Controller and get only specified input that you expect, especially for login. You can use:
$input = $request->only(['email', 'password']);