本文整理汇总了PHP中Illuminate\Session\Store类的典型用法代码示例。如果您正苦于以下问题:PHP Store类的具体用法?PHP Store怎么用?PHP Store使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Store类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @param AccountManager $manager
* @param Store $session
* @return \Illuminate\Contracts\View\View
* @throws \Exception
*/
public function index(AccountManager $manager, Store $session)
{
$account = $manager->account();
$contact = $account->contactInformation->first();
$success = $session->get('success');
return $this->theme->render('contact.' . $this->theme->setting('contactLayout'), ['contact' => $contact, 'success' => $success]);
}
示例2: testOldInputOrWithoutOldInput
/**
* Should give the fallback string when old input is not present.
*/
public function testOldInputOrWithoutOldInput()
{
$fieldName = $this->generator()->anyString();
$this->sessionStore->shouldReceive('getOldInput')->andReturn([$fieldName => []]);
$fallbackValue = $this->generator()->anyString();
$this->assertSame($fallbackValue, $this->replyComposer->oldInputOr($fieldName, $fallbackValue));
}
示例3: handle
/**
* Handle the event.
*/
public function handle(Store $session)
{
/* @var MessageBag $errors */
if ($errors = $session->get($this->builder->getOption('prefix') . 'errors')) {
$this->builder->setFormErrors($errors);
}
}
示例4: __construct
public function __construct($config = [], SessionStore $session)
{
if (is_array($config['ttwitter::config'])) {
$this->tconfig = $config['ttwitter::config'];
} else {
if (is_array($config['ttwitter'])) {
$this->tconfig = $config['ttwitter'];
} else {
throw new Exception('No config found');
}
}
$this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
$this->parent_config = [];
$this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
$this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
$this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
$this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
if ($session->has('access_token')) {
$access_token = $session->get('access_token');
if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
$this->parent_config['token'] = $access_token['oauth_token'];
$this->parent_config['secret'] = $access_token['oauth_token_secret'];
}
}
$this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
$this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
$config = array_merge($this->parent_config, $this->tconfig);
parent::__construct($this->parent_config);
}
示例5: oldInput
/**
* @return MessageBag
*/
private function oldInput()
{
if (!isset($this->oldInput)) {
$this->oldInput = new MessageBag((array) $this->sessionStore->getOldInput());
}
return $this->oldInput;
}
示例6: handle
/**
* Handle the event.
*
* @param Store $session
*/
public function handle(Store $session)
{
/* @var FieldType $field */
foreach ($this->builder->getFormFields() as $field) {
$session->flash($field->getFieldName(), $field->getPostValue());
}
}
示例7: flash
/**
* Store the messages in the current session.
*/
public function flash()
{
if (static::$session) {
static::$session->flash($this->getSessionKey(), $this);
}
return $this;
}
示例8: __construct
public function __construct(Store $session, $messages = array())
{
$this->session = $session;
if ($session->has($this->session_key)) {
$messages = array_merge_recursive($session->get($this->session_key), $messages);
}
parent::__construct($messages);
}
示例9: locale
/**
* @param Store $session
* @param Request $request
* @param AccountManager $accounts
* @return \Illuminate\Http\RedirectResponse
*/
public function locale(Store $session, Request $request, AccountManager $accounts)
{
$account = $accounts->account();
if ($request->has('locale') && $this->is_account_locale($account, $request->get('locale'))) {
$session->set('locale', $request->get('locale'));
return redirect()->to('/' . $request->get('locale'));
}
return redirect()->to(store_route('store.home'));
}
示例10: __construct
/**
* Class constructor.
*
* @param Illuminate\Html\FormBuilder $builder
* @param Illuminate\Http\Request $request
* @param Illuminate\Session\Store $session
*/
public function __construct(Builder $builder, Request $request, Session $session)
{
$this->builder = $builder;
$this->request = $request;
$this->fields = new FieldCollection();
$this->fields->setNamespace($this->namespace);
$this->fields->setBuilder($this->builder);
$this->fields->setErrorBag($session->has('errors') ? $session->get('errors')->getBag($this->namespace) : new MessageBag());
}
示例11: 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);
}
}
示例12: 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']);
}
示例13: handle
/**
* Handle the event.
*/
public function handle()
{
if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) {
$this->session->set(__CLASS__ . 'warned', true);
$this->messages->error('streams::message.delete_installer');
}
}
示例14: getUser
public function getUser()
{
if ($this->user == false) {
$this->user = $this->session->get("sharp_user");
}
return $this->user;
}
示例15: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->session->has('customer_id')) {
return redirect()->to('admin');
}
return $next($request);
}