Setting Up Ajax Validation with Laravel & VueJS in No Time
In this tutorial, Taha Shashtari tells us how to set up ajax validation with Laravel and VueJS.
It's never been easier to implement form validation in you applications like now with Laravel. All you have to do is to call $this->validate($request, ) from your controller and feed it the rules you want to validate with.
But sometimes we want to use Ajax validation so we can validate the form without reloading the page. And it's usually not very exciting to do this for every form in your application. Very quickly your code gets messy and it doesn't feel good.
Since this is a repeatable task, I thought it would be very helpful to find a way to make it easy to set up and use.
Recently, VueJS has been my main choice for every front-end task I want to accomplish. So this is what we'll use in this tutorial. Don't worry if it's new to you. It's so easy to learn. Even if you've never used it before, you can follow this tutorial easily.
After this tutorial you should be able to use Ajax validation in any form you want by just adding a few characters!