andersao / andersao/l5-repository

Why should we validate in creating method?

Abierto
#736 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
4.2k
Forks
880
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm trying to understand the decision of call the validator in create method:

https://github.com/andersao/l5-repository/blob/master/src/Prettus/Repository/Eloquent/BaseRepository.php#L619

So far as I understand, is not the responsibility of create method to validate something.
And if we already call this:
```
$this->validator->with($request->all())->passesOrFail(ValidatorInterface::RULE_CREATE);
```
In the controller action, why should we repeat the same in create method?

In my point of view that's annoying, and I can't change the data after the validation in controller and before the create method.

Well, just clarify my blur point of view please.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.