news

Laravel 5.2 gives more advanced features compared to Laravel 5.1. One of the feature included in Laravel 5.2 is “ Form Array Validation”.
#Creating blade template
We can create a simple form for using the form array validator in Laravel. Let’s imagine we want to create a form for storing user details like first name, last name etc ,so we can create a html form like,

 

{{ csrf_field() }}

Form Array validation

 

 

 

 

 

Defining The Routes
First, let’s assume we have the following routes defined in our app/Http/routes.php file:

#Creating The PostController

#Displaying Error Message In The Page
Add the below lines of code to displaying the error message in your page as a result of validation

        @foreach ($errors->all() as $error)

      • {{ $error }}

 

@endforeach

@endif

I hope this blog helps you in working on form array validation. Feel free to contact for any queries or you can use the comment box below to raise any suggestions or queries.

Learn More From Our Techies

Post By : Prakash P (2 Posts)

"Prakash P is a dedicated IT Professional and Software Engineer with 2.5, years, experience in PHP. He is a specialist in Reactjs, Laravel, Mysql. He also has the talent to handle HTML, CSS, Javascript, and Jquery."


You might also like...

INDIA OFFICE

info@cubettech.com
+91 484 4054324
Skype : cubettech
Carnival infopark,
Unit IX-C, 9th floor PhaseIV,
Kochi, Kerala, India

LONDON OFFICE

info@cubettech.com
+44 2071938618
Skype : cubettech
Kemp House
160 City Road
London- EC1V2NX, UK.
Top