Commit 92ff0474 authored by Taylor Otwell's avatar Taylor Otwell

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

parent cb306c90
......@@ -98,14 +98,19 @@ class Redirect extends Response {
* <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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment