Set the session store implementation.
public setSessionStore ( Illuminate\Session\SessionInterface $session ) | ||
$session | Illuminate\Session\SessionInterface |
/** * Register the form builder instance. * * @return void */ protected function registerFormBuilder() { $this->app->singleton('form', function ($app) { $form = new FormBuilder($app['html'], $app['url'], $app['view'], $app['session.store']->getToken()); return $form->setSessionStore($app['session.store']); }); }
/** * Register the application services. */ public function register() { $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'laform'); $this->app->bind('laform', 'Karan\\Laform\\Laform'); if (!$this->app->offsetExists('form')) { $this->app->singleton('form', function ($app) { // LaravelCollective\HtmlBuilder 5.2 is not backward compatible and will throw an exeption // https://github.com/kristijanhusak/laravel-form-builder/commit/a36c4b9fbc2047e81a79ac8950d734e37cd7bfb0 if (substr(Application::VERSION, 0, 3) == '5.2') { $form = new LaravelForm($app['html'], $app['url'], $app['view'], $app['session.store']->getToken()); } else { $form = new LaravelForm($app['html'], $app['url'], $app['session.store']->getToken()); } return $form->setSessionStore($app['session.store']); }); if (!$this->aliasExists('Form')) { AliasLoader::getInstance()->alias('Form', 'Collective\\Html\\FormFacade'); } } if (!$this->app->offsetExists('html')) { $this->app->singleton('html', function ($app) { return new HtmlBuilder($app['url'], $app['view']); }); if (!$this->aliasExists('Html')) { AliasLoader::getInstance()->alias('Html', 'Collective\\Html\\HtmlFacade'); } } }
/** * Register the form builder instance. * * @return void */ protected function registerFormBuilder() { $this->app->singleton('form', function ($app) { /** @var Store $session */ $session = $app['session.store']; $form = new FormBuilder($app['html'], $app['url'], $session->token()); $form->setSessionStore($session); return $form; }); $this->app->alias('form', 'Collective\\Html\\FormBuilder'); }
/** * Add Laravel Form to container if not already set */ private function registerFormIfHeeded() { if (!$this->app->offsetExists('form')) { $this->app->singleton('form', function ($app) { $form = new LaravelForm($app['html'], $app['url'], $app['view'], $app['session.store']->getToken()); return $form->setSessionStore($app['session.store']); }); if (!$this->aliasExists('Form')) { AliasLoader::getInstance()->alias('Form', 'Collective\\Html\\FormFacade'); } } }
/** * Set the session store implementation. * * @param \Illuminate\Session\Store $session * @return $this * @static */ public static function setSessionStore($session) { return \Collective\Html\FormBuilder::setSessionStore($session); }