andersao / andersao/l5-repository

Return Illuminate\Validation\ValidationException

Offen
#448 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4.2k
Forks
880
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

In Prettus\Validator\LaravelValidator

This method:

```
/**
* Pass the data and the rules to the validator
*
* @param string $action
* @return bool
*/
public function passes($action = null)
{
$rules = $this->getRules($action);
$messages = $this->getMessages();
$attributes = $this->getAttributes();
$validator = $this->validator->make($this->data, $rules, $messages, $attributes);

if ($validator->fails()) {
$this->errors = $validator->messages();
return false;
}

return true;
}
```

change it for:

```
/**
* Pass the data and the rules to the validator
*
* @param string $action
* @return bool
*/
public function passes($action = null)
{
$rules = $this->getRules($action);
$messages = $this->getMessages();
$attributes = $this->getAttributes();
$this->validator->make($this->data, $rules, $messages, $attributes)->validate();

return true;
}
```

This way returns the handler of Illuminate\Validation\ValidationException and the class Prettus\Validator\Exceptions\ValidatorException is not necessary any more...

Best regards.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.