allow message container to be passed into redirect->with_errors.

This commit is contained in:
Taylor Otwell 2011-12-01 23:41:01 -06:00
parent cb306c9091
commit 92ff0474a1
1 changed files with 8 additions and 3 deletions

View File

@ -98,14 +98,19 @@ public function with_input($filter = null, $items = array())
* <code>
* // 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);
* </code>
*
* @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);
}
/**