Added Redirect->with_errors method.

This commit is contained in:
Taylor Otwell 2011-11-23 10:20:25 -06:00
parent bbc8a5d0d0
commit c432b7f55d
1 changed files with 19 additions and 1 deletions

View File

@ -90,6 +90,24 @@ public function with_input($filter = null, $items = array())
return $this;
}
/**
* Flash a Validator's errors to the session data.
*
* This method allows you to conveniently pass validation errors back to views.
*
* <code>
* // Redirect and flash a validator's errors the session
* return Redirect::to('register')->with_errors($validator);
* </code>
*
* @param Validator $validator
* @return Redirect
*/
public function with_errors(Validator $validator)
{
return $this->with('errors', $validator->errors);
}
/**
* Magic Method to handle creation of redirects to named routes.
*