Hi,
When I save a model, I want to validate its contents; I use a validator and a protected array of $rules. This works perfectly fine.
However, once saved I also need to trigger some updates. Other models, caches, the works.
So when I do this:
$result = $newAccount->save();
The trigger kicks in. If the trigger returns false because something fails, that's ok. But I cannot access the validation errors. I just get back false. So I'm forced to do this in two steps; first validate, then fire the trigger. Which could still return false.
Is there a way to combine this?
$result = $newAccount->save();
if($result) {
//redirect
} else {
// somehow get the validation errors
// send back with input
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community