Created
May 22, 2015 10:25
-
-
Save NightZpy/139c9062d93ed4a87bcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
$this->registerChangeForm->validate($input); | |
$change = $this->changeRepository->create($input); | |
$this->setSuccess(true); | |
$this->addToResponseArray('change', $change); | |
$this->addToResponseArray('data', $input); | |
return $this->getResponseArrayJson(); | |
} | |
catch (FormValidationException $e) | |
//cambiarlo por | |
try | |
{ | |
$this->registerChangeForm->validate($input); | |
$change = $this->changeRepository->create($input); | |
$this->setSuccess(($change ? true : false)); | |
$this->addToResponseArray('data', ($change ? $change : $input)); | |
return $this->getResponseArrayJson(); | |
} | |
catch (FormValidationException $e) | |
{ | |
$this->setSuccess(false); | |
$this->addToResponseArray('data', $input); | |
$this->addToResponseArray('errors', $e->getErrors()->all()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment