/**
  * 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);
     }
 }
示例#2
0
 /**
  * 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);
 }
示例#3
0
 /**
  * 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);
 }
示例#4
0
 /**
  * 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'));
 }
示例#5
0
 /**
  * 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'));
 }
示例#6
0
 /**
  * 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);
 }
示例#7
0
 public function compose(View $view)
 {
     $view->with('user', $this->auth->check());
 }
示例#8
0
 public function __construct()
 {
     $this->auth = app('Modules\\Core\\Contracts\\Authentication');
     view()->share('currentUser', $this->auth->check());
 }
示例#9
0
 public function compose(View $view)
 {
     if ($user = $this->auth->check()) {
         $view->with('jwtoken', \JWTAuth::fromUser($user));
     }
 }
示例#10
0
 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');
 }
示例#12
0
 /**
  * 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));
 }
示例#13
0
 public function __construct()
 {
     $this->locale = App::getLocale();
     $this->auth = app(Authentication::class);
     view()->share('currentUser', $this->auth->check());
 }
示例#14
0
 /**
  * Get the JWT for the current user.
  */
 protected function getJWT()
 {
     if ($user = $this->auth->check()) {
         return \JWTAuth::fromUser($user);
     }
 }