/** * Add validation errors to the view. * * @param \Support\Contracts\MessageProviderInterface|array $provider * @return \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; }
/** * Parse the given errors into an appropriate value. * * @param \Support\Contracts\MessageProviderInterface|array $provider * @return \Support\MessageBag */ protected function parseErrors($provider) { if ($provider instanceof MessageProviderInterface) { return $provider->getMessageBag(); } return new MessageBag((array) $provider); }