我正在考虑如何在登录后使用额外的数据集合进行重定向。我可以用一个集合来完成:
///trait AuthenticatesUsers in Auth/LoginController
protected function sendLoginResponse(Request $request)
{
$request->session()->regenerate();
$this->clearLoginAttempts($request);
$products = Product::all();
return $this->authenticated($request, $this->guard()->user())
? : redirect()->intended($this->redirectPath())->with('pr', $products);
}
如何使用多个集合?
您可以随意多次链接with
方法:
///trait AuthenticatesUsers in Auth/LoginController
protected function sendLoginResponse(Request $request)
{
$request->session()->regenerate();
$this->clearLoginAttempts($request);
$products = Product::all();
$foo = Foo::all();
$bar = Bar::all();
return $this->authenticated($request, $this->guard()->user())
? : redirect()->intended($this->redirectPath())
->with('pr', $products)
->with('foo', $foo)
->with('bar', $bar);
}