/** * Message provider from which to extract failed validation messages * * @param string $message * @param MessageProvider $failedProvider */ public function __construct($message, MessageProvider $failedProvider = null) { if ($failedProvider) { $message = $message . "\r\nThe following fields have not passed validation:\r\n"; foreach ($failedProvider->getMessageBag()->all() as $key => $text) { $message .= $key . ' => ' . $text . "\r\n"; } } parent::__construct($message); }
/** * Add validation errors to the view. * * @param \Illuminate\Contracts\Support\MessageProvider|array $provider * @return $this */ public function withErrors($provider) { if ($provider instanceof MessageProvider) { $this->with('errors', $provider->getMessageBag()); } else { $this->with('errors', new MessageBag((array) $provider)); } return $this; }
/** * Get the validation error message provider. * * @return \Illuminate\Contracts\Support\MessageBag */ public function errors() { return $this->provider->getMessageBag(); }
/** * Parse the given errors into an appropriate value. * * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider * @return \Illuminate\Support\MessageBag */ protected function parseErrors($provider) { if ($provider instanceof MessageProvider) { return $provider->getMessageBag(); } return new MessageBag((array) $provider); }
public function withErrors(MessageProvider $errors) { $this->session->flash('fluxbb.errors', $errors->getMessageBag()); return $this; }