serlyset
1 week ago
268
9
Laravel

session::get blank

Posted 1 week ago by serlyset

i want to diplay user's data like username and name using {{Session::get(' ')}}, username successfully displayed on view but the name only blank, i'm sorry if this question sounds so stupid.

my code:

public function postLogin(Request $request)
    {
        if (auth()->guard('user')->attempt([
            'username' => $request->username,
            'password' => $request->password,
        ])) {
            Session::put('username', $request->username);
            Session::put('name', $request->name);
            return redirect()->route('dashboardPasien');
        } elseif (auth()->guard('staff')->attempt([
            'username' => $request->username,
            'password' => $request->password
        ])) {
            Session::put('username', $request->username);
            Session::put('name', $request->name);
            return $this->redirect()->action('[email protected]');
        } elseif (auth()->guard('dokter')->attempt([
            'username' => $request->username,
            'password' => $request->password
        ])) {
            Session::put('username', $request->username);
            Session::put('name', $request->name);
            return $this->redirect()->action('[email protected]');;
        }
        return back();
    }

Please sign in or create an account to participate in this conversation.