/** * @param View $view */ public function compose(View $view) { $view->with('currentUser', $this->sentinel->getUser()); $view->with('mode', array_get($view->getData(), 'mode', '')); $view->with('breadcrumbs', config('shapeshifter.breadcrumbs') ? $this->breadcrumbService->breadcrumbs() : []); $view->with('menu', $this->menuService->generateMenu()); }
/** * Authenticate against the current service. A closure may be provided * for a callback upon authentication as a shortcut for subscribing * to an event. * * @param string $slug * @param string $callbackUri * @param Closure $callback * @param bool $remember * @return \Cartalyst\Sentinel\Users\UserInterface */ public function authenticate($slug, $callbackUri, Closure $callback = null, $remember = false) { // If a callback is supplied, we'll treat it as a global linking // callback. Specific callbacks for registering and existing // users can be registered outside of this method. if ($callback) { $this->linking($callback); } $provider = $this->make($slug, $callbackUri); $token = $this->retrieveToken($provider); // We'll check if a user is already logged in. If so // Sentinel Social will link the logged in user. if ($user = $this->sentinel->getUser()) { $link = $this->linkLoggedIn($slug, $provider, $token, $user); } else { $link = $this->linkLoggedOut($slug, $provider, $token); $user = $link->getUser(); $this->login($user, $remember); } return $user; }
/** * Get the currently authenticated user. * * @return \Cartalyst\Sentinel\Users\UserInterface */ public function user() { return $this->sentinel->getUser(); }
/** * Returns the currently logged in user, lazily checking for it. * * @param bool $check * * @return User */ public function getUser($check = true) { return $this->sentinel->getUser($check); }
/** * Returns the currently logged in user, lazily checking for it. * * @param bool $check * @return \Cartalyst\Sentinel\Users\UserInterface * @static */ public static function getUser($check = true) { return \Cartalyst\Sentinel\Sentinel::getUser($check); }
/** * {@inheritDoc} */ public function getActiveUser() { return $this->sentinel->getUser(); }
/** * Constructor. * * @param \Cartalyst\Sentinel\Sentinel $sentinel * @return void */ public function __construct(Sentinel $sentinel) { $this->user = $sentinel->getUser(); }
/** * Constructor. * * @param \Cartalyst\Cart\Cart $cart * @param \Cartalyst\Sentinel\Sentinel $sentinel * @return void */ public function __construct(Cart $cart, Sentinel $sentinel) { $this->cart = $cart; $this->wishlist = app('wishlist'); $this->user = $sentinel->getUser(); }
/** * Get value from the user to be saved as the author. * * @return string|null */ protected function getUserFieldValue() { if ($user = $this->provider->getUser()) { return ($field = $this->field) ? (string) $user->{$field} : $user->getLogin(); } }
/** * @param $route * * @return bool */ private function hasAccessToRoute($route) { return !config('shapeshifter.menu_strict_auth_checking') || $route === null || $this->auth->getUser()->hasAnyAccess($route, 'superuser'); }