public function preSet(FormEvent $event)
 {
     $form = $event->getForm();
     $rootName = $form->getRoot()->getName();
     if (!$form->isRoot() && ($parent = $form->getParent())) {
         $name = $this->getDottedName($form);
         $fullName = $this->getFullName($rootName, $name);
         // Add input from the previous submit
         if ($form->getName() !== '_token' && $this->session->hasOldInput($fullName)) {
             // Get old value
             $value = $this->session->getOldInput($fullName);
             // Transform back to good data
             $value = $this->transformValue($event, $value);
             // Store on the form
             $event->setData($value);
         }
         if ($this->session->has('errors')) {
             /** @var \Illuminate\Support\ViewErrorBag $errors */
             $errors = $this->session->get('errors');
             if ($errors->has($name)) {
                 $form->addError(new FormError(implode(' ', $errors->get($name))));
             }
         }
     }
 }
 public function __construct()
 {
     $this->sessionManager = app(SessionManager::class);
     if ($this->sessionManager->has('flash_messages')) {
         $this->messages = $this->sessionManager->get('flash_messages');
     }
 }
예제 #3
0
 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     // The location session key.
     $key = 'location';
     // Removes location from the session if config option is set
     if ($this->localHostForgetLocation()) {
         $this->session->forget($key);
     }
     // Check if the location has already been set in the current session
     if ($this->session->has($key)) {
         // Set the current driver to the current session location
         $this->location = $this->session->get($key);
     } else {
         $this->setIp($ip);
         $this->location = $this->driver->get($this->ip);
         // The locations object property 'error' will be true if an
         // exception has occurred trying to grab the location
         // from the driver. Let's try retrieving the
         // location from one of our fall-backs
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set($key, $this->location);
     }
 }
예제 #4
0
파일: Cart.php 프로젝트: yewei-cao/noodle
 public function hasMessage()
 {
     if (!$this->session->has('message')) {
         return false;
     }
     return true;
 }
예제 #5
0
 function getuserfolder()
 {
     $session = new Session('demo');
     if ($session->has('userfolder')) {
         $value = $session->get('userfolder');
     }
     return $value;
 }
예제 #6
0
 public function __construct(SessionManager $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);
 }
 /**
  * {@inheritdoc}
  *
  * @see BaseFacebook::clearPersistentData()
  */
 protected function clearPersistentData($key)
 {
     if (!in_array($key, self::$kSupportedKeys)) {
         self::errorLog('Unsupported key passed to clearPersistentData.');
         return;
     }
     $session_var_name = $this->constructSessionVariableName($key);
     if ($this->laravelSession->has($session_var_name)) {
         $this->laravelSession->forget($session_var_name);
     }
 }
예제 #8
0
 /**
  * 문서에 대해서 인증한 세션이 있는지 체크
  *
  * @param ItemEntity $item board item entity
  * @return bool
  */
 public function identified(ItemEntity $item)
 {
     $sessionName = $this->getKey($item->id);
     if ($this->session->has($sessionName) === false) {
         return false;
     }
     if ($this->validate($item) === false) {
         return false;
     }
     // 세션 갱신
     $this->destroy($item);
     $this->create($item);
     return true;
 }
예제 #9
0
 /**
  * 문서에 대해서 인증한 세션이 있는지 체크
  *
  * @param Board $board board model
  * @return bool
  */
 public function identified(Board $board)
 {
     $sessionName = $this->getKey($board->id);
     if ($this->session->has($sessionName) === false) {
         return false;
     }
     if ($this->validate($board) === false) {
         return false;
     }
     // 세션 갱신
     $this->destroy($board);
     $this->create($board);
     return true;
 }
예제 #10
0
 /**
  * Shows the form for item editing.
  *
  * @param string $model Model to use.
  * @param int $id Item ID.
  * @return \Illuminate\Http\Response
  */
 public function edit($model, $id)
 {
     $this->setModel($model);
     $this->checkAction('edit');
     $item = $this->staticModelgetFormItem($id);
     if (!$item) {
         abort(404);
     }
     $title = trans('lavanda::common.edit_title', ['entity' => mb_strtolower($this->staticModelGetName()), 'id' => $id]);
     $form = $this->staticModelGetForm('put', $this->getRoute('update', ['id' => $id]), $this->session->hasOldInput() ? null : $item);
     if (!$this->session->has('back_url')) {
         $this->session->flash('back_url', $this->request->server('HTTP_REFERER'));
     } else {
         $this->session->reflash();
     }
     return view('lavanda::entity.edit', ['title' => $title, 'form' => $form]);
 }
예제 #11
0
 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     /*
      * Removes location from the session if config option is set
      */
     if ($this->localHostForgetLocation()) {
         $this->session->forget('location');
     }
     /*
      * Check if the location has already been set in the current session
      */
     if ($this->session->has('location')) {
         /*
          * Set the current driver to the current session location
          */
         $this->location = $this->session->get('location');
     } else {
         /*
          * Set the IP
          */
         $this->setIp($ip);
         /*
          * Set the location
          */
         $this->location = $this->driver->get($this->ip);
         /*
          * The locations object property 'error' will be true if an exception has
          * occurred trying to grab the location from the driver. Let's
          * try retrieving the location from one of our fall-backs
          */
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set('location', $this->location);
     }
 }
예제 #12
0
 /**
  * Get the carts content, if there is no cart content set yet, return a new empty Collection
  *
  * @return CartCollection
  */
 protected function getContent()
 {
     $content = $this->session->has($this->getInstance()) ? $this->session->get($this->getInstance()) : new CartCollection();
     return $content;
 }
예제 #13
0
 /**
  * {@inheritDoc}
  */
 public function hasAccessToken($service)
 {
     $name = $this->storageName($service);
     return $this->session->has($name);
 }