Search code examples
formsvalidationlaravelmodels

What's the best approach for data validation between forms and models on Laravel 5?


I'm used to have model and form validation together, in another framework. But I'm migrating to Laravel and trying to understand its mindset.

What's the best approach for data validation? I've seen some classes that help out on creating forms and validating requests, but isn't it unsafe to have models saving data without validating it before?

How could I integrate form (frontend), request (backend) and model validation so they all play nicely together? Or this is not done in the Laravel world at all?


Solution

  • In the end, the best way I found to solve this matter was stitching together two Laravel extensions: Ardent, an Eloquent extension that includes validation, and a fork of Laravalid, that extends the Form with jQuery basic validation: that fork includes Ardent integration.