laravel Auth - перенаправление после входа в систему с дополнительными данными - PullRequest
0 голосов
/ 04 ноября 2018

Я обдумываю, как сделать перенаправление после входа в систему с дополнительными наборами данных. Я могу сделать это с одной коллекцией:

///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);
}

Как я могу сделать это с более чем одной коллекцией?

1 Ответ

0 голосов
/ 05 ноября 2018

Вы можете связать метод 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);
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...