本文整理汇总了PHP中Illuminate\Session\Store::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::set方法的具体用法?PHP Store::set怎么用?PHP Store::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\Store
的用法示例。
在下文中一共展示了Store::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove item of the cart.
*
* @param $id
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy($id)
{
$cart = $this->getCart();
$cart->remove($id);
$this->session->set('cart', $cart);
return redirect()->route('cart');
}
示例2: processDataOfBirth
/**
* @return array
*/
public function processDataOfBirth()
{
// Get the date of birth that the user submitted
$dob = null;
if ($this->request->has('dob')) {
// field name is dob when using input type date
$dob = $this->request->get('dob');
} elseif ($this->request->has('dob_year') && $this->request->has('dob_month') && $this->request->has('dob_day')) {
// field name has _year, _month and _day components if input type select
$dob = $this->request->get('dob_year') . '-' . $this->request->get('dob_month') . '-' . $this->request->get('dob_day');
}
$remember_me = false;
if ($this->request->get('remember_me') == "on") {
$this->session->set('remembered_day', $this->request->get('dob_day'));
$this->session->set('remembered_month', $this->request->get('dob_month'));
$this->session->set('remembered_year', $this->request->get('dob_year'));
$this->session->set('remember_me', "on");
$remember_me = true;
} else {
$this->session->remove('remembered_day');
$this->session->remove('remembered_month');
$this->session->remove('remembered_year');
$this->session->remove('remember_me');
}
// return in an array for validator
return ['dob' => $dob, 'remember' => $remember_me];
}
示例3: 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');
}
}
示例4: handleDetectionComplete
/**
* This is what happens, wenn the detection passes
*
* @param $lookup
*
* @return mixed
*/
protected function handleDetectionComplete($lookup)
{
debugger()->info('Language detected: ' . $this->detected->slug);
Cookie::queue($this->keys['cookie'], $this->detected->slug);
$this->session->set($this->keys['session'], $this->detected->slug);
$this->config->set('app.locale', $this->detected->slug);
return $this->detected;
}
示例5: login
public function login($login, $password)
{
if ($login == $this->config->get("sharp.auth_user") && $password == $this->config->get("sharp.auth_pwd")) {
$this->session->set("sharp_user", $login);
return $login;
}
$this->logout();
return false;
}
示例6: merge
/**
* Merge a message onto the session.
*
* @param $type
* @param $message
*/
protected function merge($type, $message)
{
$messages = $this->session->get($type, []);
if (is_array($message)) {
$messages = array_merge($messages, $message);
}
if (is_string($message)) {
array_push($messages, $message);
}
$messages = array_unique($messages);
$this->session->set($type, $messages);
}
示例7: retrieveByCredentials
/**
* Retrieve a user by the given credentials.
*
* @param array $credentials
* @return \Illuminate\Auth\UserInterface|null
*/
public function retrieveByCredentials(array $credentials)
{
$username = $credentials[$this->params['identifier']];
$imap = @\imap_open($this->params['datasource'], $username, $credentials['password']);
if (false !== $imap) {
$credentials['id'] = $username;
$user = new $this->model($credentials);
$this->session->set('user.current', $user);
return $user;
}
return null;
}
示例8: getModuleSettings
public function getModuleSettings(Module $currentModule)
{
$this->assetPipeline->requireJs('selectize.js');
$this->assetPipeline->requireCss('selectize.css');
$this->assetPipeline->requireCss('selectize-default.css');
$this->session->set('module', $currentModule->getLowerName());
$modulesWithSettings = $this->setting->moduleSettings($this->module->enabled());
$translatableSettings = $this->setting->translatableModuleSettings($currentModule->getLowerName());
$plainSettings = $this->setting->plainModuleSettings($currentModule->getLowerName());
$dbSettings = $this->setting->savedModuleSettings($currentModule->getLowerName());
return view('setting::admin.module-settings', compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings'));
}
示例9: authorize
public function authorize()
{
$authorizationUrl = $this->provider->getAuthorizationUrl();
$this->session->set($this->getSessionStateName(), $this->provider->getState());
$this->session->reflash();
return Redirect::to($authorizationUrl);
}
示例10: 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'));
}
示例11: saveBasket
/**
* Ensure the basket is stored with current user_id and noted in the
* session.
*/
public function saveBasket()
{
if ($this->guard->user() instanceof User && $this->guard->user()->getAuthIdentifier()) {
$this->basket->user_id = $this->guard->user()->getAuthIdentifier();
}
if (!$this->basket->deleted_at) {
$this->basket->save();
}
$this->session->set(self::SESSION_BASKET, $this->basket->id);
}
示例12: handle
/**
* @param GatewayInterface $gateway
* @param Store $session
* @param Dispatcher $dispatcher
* @return mixed
* @throws TransactionFailedException
*/
public function handle(GatewayInterface $gateway, Store $session, Dispatcher $dispatcher)
{
$session->set('params', $this->details());
$response = $gateway->purchase($this->details())->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$dispatcher->fire(new TransactionRedirect($response->getMessage()));
return $response->getRedirectUrl();
} else {
$dispatcher->fire(new TransactionFailed($response->getMessage(), $response->getTransactionReference()));
throw new TransactionFailedException($response->getMessage());
}
}
示例13: install
/**
* @param array $config
* @param array $databaseConfig
*
* @return array
* @throws InstallException
*/
public function install(array $config, array $databaseConfig)
{
if (isset($config['password_generate'])) {
$config['password_field'] = str_random();
}
date_default_timezone_set($config['timezone']);
$this->session->set(static::POST_DATA_KEY, $config);
$this->session->set(static::POST_DATABASE_KEY, $databaseConfig);
$this->validation = $this->checkPostData($config);
$databaseConfig = $this->configDBConnection($databaseConfig, 'driver', 'database');
$this->connection = $this->createDBConnection($databaseConfig);
foreach ($databaseConfig as $key => $value) {
$config['db_' . $key] = $value;
}
$this->createEnvironmentFile($config);
$this->databaseDrop();
$this->initModules();
$this->databaseMigrate();
$this->databaseSeed();
$this->createAdmin($config);
return $config;
}
示例14: clean
/**
* Clear all the messages from the session.
* Useful once the messages has been rendered.
*/
public function clean()
{
$this->session->set($this->key, null);
}
示例15:
function it_can_put_items_in_the_store_on_a_specific_key(Store $store)
{
$notifications = [];
$store->set('my-key.new', $notifications)->shouldBeCalled();
$this->put('my-key.new', $notifications);
}