/** * Push a notification on the dashboard * @param string $title * @param string $message * @param string $icon * @param string|null $link */ public function push($title, $message, $icon, $link = null) { $notification = $this->notification->create(['user_id' => $this->userId ?: $this->auth->check()->id, 'icon_class' => $icon, 'link' => $link, 'title' => $title, 'message' => $message]); if (true === config('asgard.notification.config.real-time', false)) { $this->triggerEventFor($notification); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, \Closure $next) { if ($this->auth->check()) { return Redirect::route(config('asgard.user.users.redirect_route_after_login')); } return $next($request); }
/** * Handle an incoming request. * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, \Closure $next) { if (!$this->auth->check()) { return redirect()->guest('auth/login'); } return $next($request); }
/** * Reset the grid for the current user */ public function reset() { $widget = $this->widget->findForUser($this->auth->check()->id); if (!$widget) { return redirect()->route('dashboard.index')->with('warning', trans('dashboard::dashboard.reset not needed')); } $this->widget->destroy($widget); return redirect()->route('dashboard.index')->with('success', trans('dashboard::dashboard.dashboard reset')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { if (!($user = $this->user->find($id))) { flash()->error(trans('user::messages.user not found')); return redirect()->route('admin.user.user.index'); } $roles = $this->role->all(); $currentUser = $this->auth->check(); return view('user::admin.users.edit', compact('user', 'roles', 'currentUser')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, \Closure $next) { // Check if the user is logged in if (!$this->auth->check()) { // Store the current uri in the session $this->session->put('url.intended', $this->request->url()); // Redirect to the login page return $this->redirect->route('login'); } // Check if the user has access to the dashboard page if (!$this->auth->hasAccess('dashboard.index')) { // Show the insufficient permissions page return $this->application->abort(403); } return $next($request); }
public function compose(View $view) { $view->with('user', $this->auth->check()); }
public function __construct() { $this->auth = app('Modules\\Core\\Contracts\\Authentication'); view()->share('currentUser', $this->auth->check()); }
public function compose(View $view) { if ($user = $this->auth->check()) { $view->with('jwtoken', \JWTAuth::fromUser($user)); } }
public function authorize(Authentication $auth) { $userId = $this->route('id'); return $auth->check()->id == $userId || $auth->inRole('admin'); }
public function markAllAsRead() { $this->notification->markAllAsReadForUser($this->auth->check()->id); flash(trans('notification::messages.all notifications marked as read')); return redirect()->route('admin.notification.notification.index'); }
/** * Display a listing of the resource * @return Response */ public function index() { $users = $this->user->all(); $currentUser = $this->auth->check(); return view('user::admin.users.index', compact($users, $currentUser)); }
public function __construct() { $this->locale = App::getLocale(); $this->auth = app(Authentication::class); view()->share('currentUser', $this->auth->check()); }
/** * Get the JWT for the current user. */ protected function getJWT() { if ($user = $this->auth->check()) { return \JWTAuth::fromUser($user); } }