Locks the cache for a given Request.

@param Request $request A Request instance

@return bool|string true if the lock is acquired, the path to the current lock otherwise
427628
public function lock(Request $request)
    {
        $cacheKey = $this->getCacheKey($request);

        if (isset($this->locks[$cacheKey])) {
            return false;
        }

        $this->locks[$cacheKey] = $this->lockFactory
            ->createLock($cacheKey);

        return $this->locks[$cacheKey]->acquire();
    }
167230
public function moveDown(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $pageblock = $this->pageBlockRepository->moveDownById($request->get('pageblock_id'));
        return $pageblock;
    }
932542
protected function secondsRemainingOnLockout( Request $request )
	{
		return UniversalBuilder::resolveClass( RateLimiter::class )->availableIn( $this->getThrottleKey( $request ) );
	}
1260026
public function login( Request $request )
	{
		$this->validateLogin( $request );

		// If the class is using the ThrottlesLogins trait, we can automatically throttle
		// the login attempts for this application. We'll key this by the username and
		// the IP address of the client making these requests into this application.
		$throttles = $this->isUsingThrottlesLoginsTrait();

		if ( $throttles && $lockedOut = $this->hasTooManyLoginAttempts( $request ) )
		{
			$this->fireLockoutEvent( $request );

			// return $this->sendLockoutResponse( $request );
		}

		$credentials = $this->getCredentials( $request );
		if ( Acct::guard( $this->getGuard() )->attempt( $credentials, $request->has( 'remember' ) ) )
			return $this->handleUserWasAuthenticated( $request, $throttles );

		// If the login attempt was unsuccessful we will increment the number of attempts
		// to login and redirect the user back to the login form. Of course, when this
		// user surpasses their maximum number of attempts they will get locked out.
		if ( $throttles && !$lockedOut )
			$this->incrementLoginAttempts( $request );

		return $this->sendFailedLoginResponse( $request );
	}
503293
public function isLocked(Request $request)
    {
        $cacheKey = $this->getCacheKey($request);

        if (!isset($this->locks[$cacheKey])) {
            return false;
        }

        return $this->locks[$cacheKey]->isAcquired();
    }
94647
public function forceunlockAction(Request $request)
    {
        // get request parameters
        $eid = (int) $request->get('eid');
        $language = $request->get('language');

        // get helpers from container
        $elementService = $this->get('phlexible_element.element_service');
        $lockManager = $this->get('phlexible_element.element_lock_manager');

        // get element data object
        $element = $elementService->findElement($eid);

        $lockManager->unlock($element);

        return new ResultResponse(true, 'Lock removed.');
    }
1114244
protected function attemptLogin(Request $request)
    {
        return $this->guard()->attempt($this->credentials($request),
            $request->has('remember'));
    }
925590
public function forUser(Request $request)
    {
        $tokens = $this->tokenRepository->forUser($request->user()->getKey());

        return $tokens->load('client')->filter(function ($token) {
            return ! $token->client->firstParty() && ! $token->revoked;
        })->values();
    }
973038
public function sync(Request $request)
    {

        try {
            $logged_in_user = Auth::user();

            $oauth_user = null;
            if ($logged_in_user['oauth_token']) {
                $oauth_user = Socialite::getUserByExistingToken($logged_in_user['oauth_token']);
            }

            if ($oauth_user) {
                $tokenly_uuid       = $oauth_user->id;
                $oauth_token        = $oauth_user->token;
                $username           = $oauth_user->user['username'];
                $name               = $oauth_user->user['name'];
                $email              = $oauth_user->user['email'];
                $email_is_confirmed = $oauth_user->user['email_is_confirmed'];

                // find an existing user based on the credentials provided
                $existing_user = User::where('tokenly_uuid', $tokenly_uuid);
                if ($existing_user) {
                    // update
                    $existing_user->update(['name' => $name, 'email' => $email, /* etc */ ]);
                }

                $synced = true;
            } else {
                // not able to sync this user
                $synced = false;
            }

            return view('account.sync', ['synced' => $synced, 'user' => $logged_in_user, ]);

        } catch (Exception $e) {
            return view('account.sync-failed', ['error_msg' => 'Failed to sync this user.']);
        }
    }
848152
public function meetsConstraints(Request $request)
    {
        foreach ($this->constraints as $constraint) {
            if (!$constraint($request)) {
                return false;
            }
        }

        return true;
    }
683021
public static function getFromRequest(Request $request)
    {
        // if something has already set a page object, we return it
        $c = $request->getCurrentPage();
        if (is_object($c)) {
            return $c;
        }
        if ($request->getPath() != '') {
            $path = $request->getPath();
            $db = Database::connection();
            $cID = false;
            $ppIsCanonical = false;
            while ((!$cID) && $path) {
                $row = $db->fetchAssoc('select cID, ppIsCanonical from PagePaths where cPath = ?', array($path));
                if (!empty($row)) {
                    $cID = $row['cID'];
                    if ($cID) {
                        $cPath = $path;
                        $ppIsCanonical = (bool) $row['ppIsCanonical'];
                        break;
                    }
                }
                $path = substr($path, 0, strrpos($path, '/'));
            }

            if ($cID && $cPath) {
                $c = static::getByID($cID, 'ACTIVE');
                $c->cPathFetchIsCanonical = $ppIsCanonical;
            } else {
                $c = new Page();
                $c->loadError(COLLECTION_NOT_FOUND);
            }

            return $c;
        } else {
            $cID = $request->query->get('cID');
            if (!$cID) {
                $cID = $request->request->get('cID');
            }
            $cID = Core::make('helper/security')->sanitizeInt($cID);
            if (!$cID) {
                $cID = 1;
            }
            $c = static::getByID($cID, 'ACTIVE');
            $c->cPathFetchIsCanonical = true;
        }

        return $c;
    }
1337432
public function lookup(Request $request)
    {
        $cacheKey = $this->getCacheKey($request);

        $item = $this->cache->getItem($cacheKey);

        if (!$item->isHit()) {
            return null;
        }

        $entries = $item->get();

        foreach ($entries as $varyKeyResponse => $responseData) {
            // This can only happen if one entry only
            if (self::NON_VARYING_KEY === $varyKeyResponse) {
                return $this->restoreResponse($responseData);
            }

            // Otherwise we have to see if Vary headers match
            $varyKeyRequest = $this->getVaryKey(
                $responseData['vary'],
                $request
            );

            if ($varyKeyRequest === $varyKeyResponse) {
                return $this->restoreResponse($responseData);
            }
        }

        return null;
    }
285870
public function dispatch(Request $request)
    {
        $this->authorize($request);

        return $this->next->dispatch($request);
    }
46775
public static function canBeUsedForRequest(Request $request)
    {
        $hasChunkParams = $request->has(static::KEY_CHUNK_NUMBER)
                          && $request->has(static::KEY_TOTAL_SIZE)
                          && $request->has(static::KEY_CHUNK_SIZE)
                          && $request->has(static::KEY_CHUNK_CURRENT_SIZE);

        return $hasChunkParams && self::checkChunkParams($request);
    }
364420
private function getCacheKey(Request $request)
    {
        if (isset($this->keyCache[$request])) {
            return $this->keyCache[$request];
        }

        return $this->keyCache[$request] = $this->generateCacheKey($request);
    }
804500
protected function folderIsNotAccessible(Request $request)
    {
        if (isset($request['folder']) && empty($request->get('folder'))) {
            return true;
        }

        return ! Storage::exists($this->currentDir) && $request->has('folder') || $request->get('folder') === 'public';
    }
232772
public function execute(Request $request)
    {
        if (!$this->requireProvider("Executing cache request")) return null;

        $cacheKey = $request->getCacheKey();

        if (empty($cacheKey)) {
            if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
            return null;
        }

        $cacheRefresh = $request->getForceRefresh();

        if (!$cacheRefresh) {
            $cacheData = $this->cacheProvider->get($cacheKey);

            if (!empty($cacheData)) {
                if (!empty($this->log)) $this->log->debug("Cache hit on key " . $cacheKey);

                return $cacheData;
            }
        }

        if (!empty($this->log)) $this->log->debug("CACHE", "Cache miss on key " . $cacheKey);

        $value = $request->executeCallback();

        if (!empty($value)) {
            $this->cacheProvider->set($cacheKey, $value, $request->getCacheTTL());
        }

        return $value;
    }