Skip to content

Commit e6d3c66

Browse files
committed
Update authenticated method to store user roles in session
1 parent f4da04e commit e6d3c66

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Http/Controllers/LoginController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ public function showLoginForm()
6060
*/
6161
protected function authenticated(Request $request, $user)
6262
{
63+
$roles = Pengelola::cache()->get('all')->where('user_id', Auth::user()->id)->whereNull('inactive')->pluck('role')->toArray();
6364
$redirect = redirect()->intended($this->redirectPath($request));
6465
session(['year' => $request->input('year')]);
65-
session(['role' => 'anggota']);
66+
session(['role' => $roles]);
6667
return $request->wantsJson()
6768
? new JsonResponse([
6869
'redirect' => $redirect->getTargetUrl(),

0 commit comments

Comments
 (0)