本文整理汇总了PHP中Illuminate\Session\Store::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::put方法的具体用法?PHP Store::put怎么用?PHP Store::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\Store
的用法示例。
在下文中一共展示了Store::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeResponse
protected function makeResponse(Request $request)
{
$message = $this->translator->get('c::auth.login-required');
if ($request->ajax() || $request->isJson() || $request->wantsJson()) {
return Response::json(['error' => $message], 403);
} else {
$url = $this->url->action('anlutro\\Core\\Web\\AuthController@login');
$intended = $request->getMethod() == 'GET' ? $request->fullUrl() : ($request->header('referer') ?: '/');
$this->session->put('url.intended', $intended);
return $this->redirect->to($url)->with('error', $message);
}
}
示例2: validate
/**
* Validate what is passed into the age gate
*
* @param array $data
* @return $this|Validation|\Illuminate\Http\RedirectResponse
*/
public function validate(array $data)
{
$this->validation = $this->validator->make($data, $this->getValidationRules(), $this->getValidationMessages());
if ($this->validation->fails()) {
$failed = $this->validation->failed();
$validExceptTooYoung = array_get($failed, 'dob.Before');
$canTryAgain = config('laravel-avp.can_try_again');
$toRedirect = config('laravel-avp.redirect_on_error');
$redirectURL = config('laravel-avp.redirect_url');
if (substr($data['dob'], 0, 4) > date('Y')) {
return redirect()->action('AVPController@agegate')->withErrors($this->validation->messages())->withInput();
} else {
if ($validExceptTooYoung && $toRedirect) {
return redirect($redirectURL);
} else {
if ($validExceptTooYoung && !$canTryAgain) {
$this->session->put('laravel-avp.previous_too_young', true);
} else {
$this->session->keep('url.intended');
}
}
}
return redirect()->action('AVPController@agegate')->withErrors($this->validation->messages())->withInput();
}
return $this->setCookie($data['remember']);
}
示例3: index
/**
* Show the cart items.
*
* @return \Illuminate\View\View
*/
public function index()
{
if (!$this->session->has('cart')) {
$this->session->put('cart', $this->cart);
}
$cart = $this->session->get('cart');
return view('ecomm.shop.cart', ['cart' => $cart]);
}
示例4: postValidate
public function postValidate()
{
$validator = $this->validator->make($this->input->all(), array('recaptcha_response_field' => 'required|recaptcha'));
if ($validator->fails()) {
return $this->response->json(array('result' => 'failed'));
}
$this->session->put('captcha.passed.time', $this->mockably->microtime());
return $this->response->json(array('result' => 'success'));
}
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if ($this->isCacheable($request)) {
$uri = $request->getUri();
$this->store->put($this->sessionKey, $uri);
}
return $response;
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->auth->user()->isConfirmed()) {
// Don't let people who haven't confirmed their email use the authed sections on the website.
$this->session->put('error', 'Please confirm your email address (' . $this->auth->user()->email . ') before you try to use this section.
<a style="color:#fff" href="' . route('auth.reconfirm') . '">Re-send confirmation email.</a>
<a href="' . route('user.settings', $this->auth->user()->name) . '" style="color:#eee;">Change e-mail address.</a>');
return redirect()->home();
}
return $next($request);
}
示例7: publish
/**
* Publish process.
*
* @param \Orchestra\Contracts\Foundation\Listener\AssetPublishing $listener
* @param array $input
*
* @return mixed
*/
public function publish(Listener $listener, array $input)
{
$queues = $this->publisher->queued();
// Make an attempt to connect to service first before
try {
$this->publisher->connect($input);
} catch (ServerException $e) {
$this->session->forget('orchestra.ftp');
return $listener->publishingHasFailed(['error' => $e->getMessage()]);
}
$this->session->put('orchestra.ftp', $input);
if ($this->publisher->connected() && !empty($queues)) {
$this->publisher->execute();
}
return $listener->publishingHasSucceed();
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (config('misc.session_timeout_status')) {
$isLoggedIn = $request->path() != '/logout';
if (!session('lastActivityTime')) {
$this->session->put('lastActivityTime', time());
} elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) {
$this->session->forget('lastActivityTime');
$cookie = cookie('intend', $isLoggedIn ? url()->current() : 'admin/dashboard');
$email = $request->user()->email;
access()->logout();
return redirect()->route('frontend.auth.login')->withFlashWarning(trans('strings.backend.general.timeout') . $this->timeout / 60 . trans('strings.backend.general.minutes'))->withInput(compact('email'))->withCookie($cookie);
}
$isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime');
}
return $next($request);
}
示例9: storeAuthorizationState
/**
* @param string $service
* @param string $state
* @return TokenStorageInterface
*/
public function storeAuthorizationState($service, $state)
{
$states = $this->session->get($this->stateVariableName, array());
$states[$service] = $state;
$this->session->put($this->stateVariableName, $states);
// allow chaining
return $this;
}
开发者ID:Superbalist,项目名称:laravel-lusitanian-oauth-session-store,代码行数:13,代码来源:LaravelTokenSessionStore.php
示例10: generate
/**
* Generate captcha text
*
* @return string
*/
protected function generate()
{
$characters = str_split($this->characters);
$bag = '';
for ($i = 0; $i < $this->length; $i++) {
$bag .= $characters[rand(0, count($characters) - 1)];
}
$this->session->put('captcha', ['sensitive' => $this->sensitive, 'key' => $this->hasher->make($this->sensitive ? $bag : $this->str->lower($bag))]);
return $bag;
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string $requiredScope
* @return mixed
* @throws \OAuth2\Exception
*/
public function handle(Request $request, Closure $next, $requiredScope)
{
// Ensure this is a valid OAuth client.
$accessToken = $this->determineAccessToken($request, false);
// check that access token is valid at Poniverse.net
$accessTokenInfo = $this->poniverse->getAccessTokenInfo($accessToken);
if (!$accessTokenInfo->getIsActive()) {
throw new AccessDeniedHttpException('This access token is expired or invalid!');
}
if (!in_array($requiredScope, $accessTokenInfo->getScopes())) {
throw new AccessDeniedHttpException("This access token lacks the '{$requiredScope}' scope!");
}
// Log in as the given user, creating the account if necessary.
$this->poniverse->setAccessToken($accessToken);
$this->session->put('api_client_id', $accessTokenInfo->getClientId());
$poniverseUser = $this->poniverse->getUser();
$user = User::findOrCreate($poniverseUser['username'], $poniverseUser['display_name'], $poniverseUser['email']);
$this->auth->onceUsingId($user);
return $next($request);
}
示例12: getAccessToken
/**
* Get the access token
*
* POSTs to the SeeClickFix API and obtains and access key
*
* @param string $code Code supplied by SeeClickFix
* @return string Returns the access token
* @throws \SeeClickFix\Core\ApiException
*/
public function getAccessToken($code)
{
$token = $this->api->getAccessToken($code);
$this->api->setAccessToken($token);
$this->user = $this->getCurrentUser();
// Create an array of data to persist to the session
$toPersist = array($this->user->getId(), $token);
// Set sessions
$this->session->put('seeclickfix_access_token', $toPersist);
return $token;
}
示例13: setRowsPerPage
/**
* Set the number of rows per page for this data table
*
* @param \Illuminate\Session\Store $session
* @param int $globalPerPage
* @param int $override //if provided, this will set the session's rows per page value
*/
public function setRowsPerPage(\Illuminate\Session\Store $session, $globalPerPage, $override = null)
{
if ($override) {
$perPage = (int) $override;
$session->put('administrator_' . $this->config->getOption('name') . '_rows_per_page', $perPage);
}
$perPage = $session->get('administrator_' . $this->config->getOption('name') . '_rows_per_page');
if (!$perPage) {
$perPage = (int) $globalPerPage;
}
$this->rowsPerPage = $perPage;
}
示例14: storeViewedTricks
/**
* Store the recently viewed tricks in the session.
*
* @param array $tricks
*
* @return void
*/
protected function storeViewedTricks(array $tricks)
{
$this->session->put('viewed_tricks', $tricks);
}
示例15: updateSession
/**
* @param \League\OAuth2\Client\Token\AccessToken $accessToken
*/
protected function updateSession(AccessToken $accessToken)
{
$this->session->put($this->getSessionName(), $accessToken);
}