/** * Parse the given errors into an appropriate value. * * @param \Nova\Support\Contracts\MessageProviderInterface|array $provider * @return \Nova\Support\MessageBag */ protected function parseErrors($provider) { if ($provider instanceof MessageProviderInterface) { return $provider->getMessageBag(); } return new MessageBag((array) $provider); }
/** * Add validation errors to the view. * * @param \Nova\Support\Contracts\MessageProviderInterface|array $provider * @return \Nova\View\View */ public function withErrors($provider) { if ($provider instanceof MessageProviderInterface) { $this->with('errors', $provider->getMessageBag()); } else { $this->with('errors', new MessageBag((array) $provider)); } return $this; }