However, in the example above, all input fields are optional.
I already know password rules beside length are counter-productive. Also, I know that performance is absolutely trivial here.
for that here we are giving a simple session to a user.
Note: here we are giving username and password to a variable called $rowcount.
As mentioned previously, Laravel will automatically redirect the user back to their previous location.
In addition, all of the validation errors will automatically be flashed to the session.
And when the page loads, the Java Script code will be executed (the user will see an alert box).
This is just a simple and harmless example how the PHP_SELF variable can be exploited.
If the username and Password matches with the database values we need to assign a session to that user..
First, let's assume we have the following routes defined in our method accepts an incoming HTTP request and a set of validation rules.
If the validation rules pass, your code will keep executing normally; however, if validation fails, an exception will be thrown and the proper error response will automatically be sent back to the user.
trait which provides a convenient method to validate incoming HTTP request with a variety of powerful validation rules.
To learn about Laravel's powerful validation features, let's look at a complete example of validating a form and displaying the error messages back to the user.