diff --git a/laravel/redirect.php b/laravel/redirect.php index 2fdffa3f..828c40a6 100644 --- a/laravel/redirect.php +++ b/laravel/redirect.php @@ -98,14 +98,19 @@ class Redirect extends Response { * * // Redirect and flash a validator's errors the session * return Redirect::to('register')->with_errors($validator); + * + * // Redirect and flash a message container to the session + * return Redirect::to('register')->with_errors($messages); * * - * @param Validator $validator + * @param Validator|Messages $container * @return Redirect */ - public function with_errors(Validator $validator) + public function with_errors($container) { - return $this->with('errors', $validator->errors); + $errors = ($container instanceof Validator) ? $container->errors : $container; + + return $this->with('errors', $errors); } /**