laravel - 如何在 Laravel4 中使用 withErrors 处理异常错误消息?

标签 laravel laravel-4

假设我有这个异常消息

catch (Cartalyst\Sentry\Users\LoginRequiredException $e)
{
     echo 'Login field is required.';
}

如何使用 withErrors() 传递此消息需要登录字段

return Redirect::to('admin/users/create')->withInput()->withErrors();

最佳答案

return Redirect::to('admin/users/create')
       ->withInput()
       ->withErrors(array('message' => 'Login field is required.'));

关于laravel - 如何在 Laravel4 中使用 withErrors 处理异常错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18367769/

相关文章:

laravel - Laravel自定义错误

php - 为 Controller 设置变量 - Laravel 4

Laravel 中的 PHPexcel header

php - 使用数据库中的值进行动态邮件配置 [Laravel]

php - Laravel 验证 : check why validator failed

php - Laravel 4 - 资源 Controller 添加组前缀而不更改路由名称

php - 拉维尔 : Your requirements could not be resolved to an installable set of packages

php - Laravel 获取带有多个标签的帖子

php - 如何在我的表中获取最后一个 reasonID?

php - 从 Laravel 数据库查询结果中访问明显存在的整数类型数据时出现错误 "Cannot use object of type stdClass as array"