/**
  * Handle the command.
  *
  * @param Application $application
  * @param Factory $views
  */
 public function handle(Application $application, Factory $views)
 {
     $views->composer('*', 'Anomaly\\Streams\\Platform\\View\\ViewComposer');
     $views->addNamespace('streams', __DIR__ . '/../../../resources/views');
     $views->addNamespace('resources', base_path('resources/views'));
     $views->addNamespace('storage', $application->getStoragePath());
     $views->addNamespace('app', $application->getResourcesPath());
     $views->addNamespace('root', base_path());
     $views->addExtension('html', 'php');
 }
Ejemplo n.º 2
0
 /**
  * Register a valid view extension and its engine.
  *
  * @param string $extension
  * @param string $engine
  * @param \Closure $resolver
  * @return void 
  * @static 
  */
 public static function addExtension($extension, $engine, $resolver = null)
 {
     \Illuminate\View\Factory::addExtension($extension, $engine, $resolver);
 }
Ejemplo n.º 3
0
 /**
  * Register the view factory. The factory is
  * available in all views.
  */
 protected function registerViewFactory()
 {
     // Register the View Finder first.
     $this->app->singleton('view.finder', function ($container) {
         return new ViewFinder($container['filesystem'], [], ['blade.php', 'scout.php', 'twig', 'php']);
     });
     $this->app->singleton('view', function ($container) {
         $factory = new Factory($container['view.engine.resolver'], $container['view.finder'], $container['events']);
         // Set the container.
         $factory->setContainer($container);
         // Tell the factory to also handle the scout template for backwards compatibility.
         $factory->addExtension('scout.php', 'blade');
         // Tell the factory to handle twig extension files and assign them to the twig engine.
         $factory->addExtension('twig', 'twig');
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $factory->setContainer($container);
         $factory->share('app', $container);
         return $factory;
     });
 }