dwightwatson / validating

Automatically validating Eloquent models for Laravel
MIT License
968 stars 76 forks source link

Question about usage #208

Closed kamov closed 5 years ago

kamov commented 5 years ago

I found this package useful for keep validation only on one place, in models.

So we could remove validation from custom request class.

But in the end of docs you are suggesting to use custom class request, which have own validation rule, and also your model validation rules.

Is not redundant in this way?

Thanks

dwightwatson commented 5 years ago

Yes and no, it just illustrates that the two concepts can be used together if need be. Especially in cases where your form's input (for whatever reason) doesn't directly map one-to-one with a model. Also because this package was released before the FormRequest approach to validation was introduced, which is now the generally accepted way of doing validation in Laravel rather than model validation. Hope this helps!