/** * Register the View Factory. * * @return void */ public function registerFactory() { $this->app->bindShared('view', function ($app) { $resolver = $app['view.engine.resolver']; $factory = new Factory($resolver, $app['view.finder']); $factory->share('app', $app); return $factory; }); }
/** * Add a key / value pair to the shared view data. * * Shared view data is accessible to every view created by the application. * * @param string $key * @param mixed $value * @return View */ public function shares($key, $value) { $this->factory->share($key, $value); return $this; }