Skip to content

Commit

Permalink
[refactor]: refactor the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-webkul committed Oct 9, 2024
1 parent 132e3d7 commit 7341ca2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ public function store()
'password' => 'required',
]);

$user = auth()->guard('user');
$userGuard = auth()->guard('user');

if (! $user->attempt(request(['email', 'password']), request('remember'))) {
if (! $userGuard->attempt(request(['email', 'password']), request('remember'))) {
session()->flash('error', trans('admin::app.users.login-error'));

return redirect()->back();
}

if ($user->user()->status == 0) {
if ($userGuard->user()->status == 0) {
session()->flash('warning', trans('admin::app.users.activate-warning'));

$user->logout();
$userGuard->logout();

return redirect()->route('admin.session.create');
}

if ($user->user()->role->permission_type !== 'all') {
if ($userGuard->user()->role->permission_type !== 'all') {
return redirect()->route(menu()->getItems('admin')->first()->getRoute());
}

Expand Down

0 comments on commit 7341ca2

Please sign in to comment.