From 92ff0474a18fed4ba4351c3930fc46b078e219e5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 1 Dec 2011 23:41:01 -0600 Subject: [PATCH] allow message container to be passed into redirect->with_errors. --- laravel/redirect.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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); } /**