本文整理汇总了PHP中Illuminate\Session\SessionManager::driver方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::driver方法的具体用法?PHP SessionManager::driver怎么用?PHP SessionManager::driver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::driver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usingCookieSessions
/**
* Determine if the session is using cookie sessions.
*
* @return bool
*/
protected function usingCookieSessions()
{
if (!$this->sessionConfigured()) {
return false;
}
return $this->manager->driver()->getHandler() instanceof CookieSessionHandler;
}
示例2: getSession
/**
* @param RequestInterface $request
* @return SessionInterface
*/
private function getSession(RequestInterface $request)
{
$session = $this->manager->driver();
$cookieData = FigRequestCookies::get($request, $session->getName());
$session->setId($cookieData->getValue());
return $session;
}
示例3: handleProviderCallback
public function handleProviderCallback(Guard $auth, Socialite $socialite, UsersService $userService, SessionManager $manager)
{
$user = $socialite->driver('facebook')->user();
$authUser = $userService->findOrCreateByFacebook($user);
$auth->login($authUser);
$manager->driver()->save();
return redirect('/');
}
示例4: startSession
public function startSession()
{
$encrypter = $this->createEncrypter();
$manager = new SessionManager($this->laravel);
$session = $manager->driver();
$this->updateSessionId($encrypter, $session);
$session->start();
$this->bindNewSession($session);
}
示例5: getSession
/**
* getSession.
*
* @method getSession
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Session\Store
*/
protected function getSession($request)
{
$session = $this->sessionManager->driver();
if ($session->isStarted() === false) {
$session->setId($request->cookies->get($session->getName()));
$session->setRequestOnHandler($request);
$session->start();
}
return $session;
}
示例6: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['session'] = $this->app->share(function ($app) {
// First, we will create the session manager which is responsible for the
// creation of the various session drivers when they are needed by the
// application instance, and will resolve them on a lazy load basis.
$manager = new SessionManager($app);
$driver = $manager->driver();
$config = $app['config']['session'];
// Once we get an instance of the session driver, we need to set a few of
// the session options based on the application configuration, such as
// the session lifetime and the sweeper lottery configuration value.
$driver->setLifetime($config['lifetime']);
$driver->setSweepLottery($config['lottery']);
return $driver;
});
}
示例7: driver
/**
* Get a driver instance.
*
* @param string $driver
* @return mixed
* @static
*/
public static function driver($driver = null)
{
//Method inherited from \Illuminate\Support\Manager
return \Illuminate\Session\SessionManager::driver($driver);
}
示例8: getSession
/**
* Get the session implementation from the manager.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Illuminate\Session\SessionInterface
*/
public function getSession(Request $request)
{
$session = $this->manager->driver();
$session->setId($request->cookies->get($session->getName()));
return $session;
}
示例9: array
// Not 100% sure on how many of these are needed
$container['config']['session.lifetime'] = 120;
// Minutes idleable
$container['config']['session.expire_on_close'] = false;
$container['config']['session.lottery'] = array(2, 100);
// lottery--how often do they sweep storage location to clear old ones?
$container['config']['session.cookie'] = 'laravel_session';
$container['config']['session.path'] = '/';
$container['config']['session.domain'] = null;
$container['config']['session.driver'] = 'file';
$container['config']['session.files'] = $path . '/sessions';
// Cookie time
$container['cookie'] = (new CookieJar())->setDefaultPathAndDomain('/', null);
// Now we need to fire up the session manager
$sessionManager = new SessionManager($container);
$container['session.store'] = $sessionManager->driver();
$container['session'] = $sessionManager;
// In order to maintain the session between requests, we need to populate the
// session ID from the supplied cookie
$cookieName = $container['session']->getName();
if (isset($_COOKIE[$cookieName])) {
if ($sessionId = $_COOKIE[$cookieName]) {
$container['session']->setId($sessionId);
}
}
// Boot the session
$container['session']->start();
// END BOOTSTRAP---------------------------------------------------------------
// View
$app->get('/', function () use($container) {
echo 'Current state of <code>$test</code>: ';
示例10: __construct
/**
* __construct.
*
* @method __construct
*
* @param \Illuminate\Session\SessionManager $sessionManager
*/
public function __construct(SessionManager $sessionManager)
{
$this->session = $sessionManager->driver();
}
示例11: __construct
public function __construct(SessionManager $session, array $processors = null)
{
$this->processors = $processors;
$this->session = $session->driver();
}
示例12: elfinder
/**
* elfinder.
*
* @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory
* @param \Illuminate\Session\SessionManager $sessionManager
*
* @return mixed
*/
public function elfinder(ResponseFactory $responseFactory, SessionManager $sessionManager)
{
$token = $sessionManager->driver()->token();
return $responseFactory->view('elfinder::elfinder', compact('token'));
}
示例13: terminate
/**
* Perform any final actions for the request lifecycle.
*
* @param \Illuminate\Http\Request $request
* @param \Symfony\Component\HttpFoundation\Response $response
* @return void
*/
public function terminate($request, $response)
{
if ($this->sessionHandled && $this->sessionConfigured() && !$this->usingCookieSessions()) {
$this->manager->driver()->save();
}
}
示例14: getSession
/**
* Get the session implementation from the manager.
*
* @return \Illuminate\Session\SessionInterface
*/
public function getSession()
{
return $this->manager->driver();
}
示例15: Config
Illuminate\Support\Facades\Facade::setFacadeApplication($app);
$app['app'] = $app;
$app['env'] = 'production';
$app['path'] = $basePath . '/app';
$app['path.lang'] = base_path('resources/lang');
$request = Illuminate\Http\Request::capture();
$app['request'] = $request;
/*load configure*/
$app['config'] = new Config(require base_path('config/config.php'));
/*end load configure*/
/*init new filesystem and register to container*/
$app['files'] = new Filesystem();
/*end init new filesystem and register to container*/
/*session manager*/
$sessionManager = new SessionManager($app);
$app['session.store'] = $sessionManager->driver();
$app['session'] = $sessionManager;
// In order to maintain the session between requests, we need to populate the
// session ID from the supplied cookie
$cookieName = $app['session']->getName();
if (isset($_COOKIE[$cookieName])) {
if ($sessionId = $_COOKIE[$cookieName]) {
$app['session']->setId($sessionId);
}
}
// Boot the session
$app['session']->start();
/*end session manager*/
/*setup cookie*/
$cookie = new Cookie($app['session']->getName(), $app['session']->getId(), time() + $app['config']['session.lifetime'] * 60, '/', null, false);
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain());