【发布时间】:2016-12-17 05:49:17
【问题描述】:
我了解如何使用 redirect() 方法重定向用户,但此方法返回 302 代码并且浏览器必须发出第二个 HTTP 请求。是否可以在内部将请求转发到不同的控制器和操作?
我正在中间件中进行此检查,因此我的句柄函数如下所示:
public function handle($request, Closure $next)
{
if (auth()->user->age <= 20) { //example
//internally forward the user to a different controller@action
}
return $next($request);
}
}
【问题讨论】: