/** * Flash a container of messages to the session. * * @param Illuminate\Support\Contracts\MessageProviderInterface|array $provider * @return Ghunti\LaravelBase\Http\RedirectResponse */ public function withMessages($provider) { if ($provider instanceof MessageProviderInterface) { $this->with('messages', $provider->getMessageBag()); } else { $this->with('messages', new MessageBag((array) $provider)); } return $this; }
/** * Flash a container of errors to the session. * * @param Illuminate\Support\Contracts\MessageProviderInterface|array $provider * @return void */ public function withErrors($provider) { if ($provider instanceof MessageProviderInterface) { $this->with('errors', $provider->getMessageBag()); } else { $this->with('errors', (array) $provider); } return $this; }
/** * Parse the given errors into an appropriate value. * * @param \Illuminate\Support\Contracts\MessageProviderInterface|array $provider * @return \Illuminate\Support\MessageBag */ protected function parseErrors($provider) { if ($provider instanceof MessageProviderInterface) { return $provider->getMessageBag(); } else { return new MessageBag((array) $provider); } }