put() public method

Put a value in the Sentinel session.
public put ( mixed $value ) : void
$value mixed
return void
コード例 #1
0
ファイル: Manager.php プロジェクト: sohailaammarocs/lfc
 /**
  * Returns the authorize URL for a connection with the given
  * slug. Abstracts away the differences between OAuth1 and
  * OAuth2 for a uniform API.
  *
  * @param  string  $slug
  * @param  string  $callbackUri
  * @return string
  */
 public function getAuthorizationUrl($slug, $callbackUri)
 {
     $provider = $this->make($slug, $callbackUri);
     // OAuth 1 is a three-legged authentication process
     // and thus we need to grab temporary credentials
     // first.
     if ($this->oauthVersion($provider) == 1) {
         $temporaryCredentials = $provider->getTemporaryCredentials();
         $this->session->put($temporaryCredentials);
         return $provider->getAuthorizationUrl($temporaryCredentials);
     }
     return $provider->getAuthorizationUrl();
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function persist(PersistableInterface $persistable, $remember = false)
 {
     if ($this->single) {
         $this->flush($persistable);
     }
     $code = $persistable->generatePersistenceCode();
     $this->session->put($code);
     if ($remember === true) {
         $this->cookie->put($code);
     }
     $persistence = $this->createModel();
     $persistence->{$persistable->getPersistableKey()} = $persistable->getPersistableId();
     $persistence->code = $code;
     return $persistence->save();
 }
コード例 #3
0
 /**
  * Adds a new user persistence to the current session and attaches the user.
  *
  * @param User $persistable
  * @param bool $remember
  * @return bool
  */
 public function persist(PersistableInterface $persistable, $remember = false)
 {
     try {
         if ($this->single) {
             $this->flush($persistable);
         }
         $code = $persistable->generatePersistenceCode();
         $this->session->put($code);
         if ($remember === true) {
             $this->cookie->put($code);
         }
         $persistence = $this->create($persistable, $code);
         $entityManager = $this->getEntityManager();
         $entityManager->persist($persistence);
         $entityManager->flush();
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }