/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->user->auth->check()) { if ($this->user->can('access', 'admin')) { return redirect()->route('AdminDashboard'); } else { return redirect('/'); } } return $next($request); }
/** * The user logout method * * @return \Illuminate\Http\RedirectResponse */ public function logout() { $this->user->logout(); Session::flush(); return redirect()->route('AdminLoginView'); }
/** * Get total points of the user * * @return Response */ public function getPoints() { $userPoints = User::showPoints(); return response()->json($userPoints, 200); }
/** * Execute the command. * * @param User $user * @return array */ public function handle(User $user) { $response = $user->register($this->full_name, $this->email, $this->password); event(new NewUserWasRegistered($this->email, $this->full_name)); return $response; }