本文整理汇总了PHP中Illuminate\View\Factory::addExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::addExtension方法的具体用法?PHP Factory::addExtension怎么用?PHP Factory::addExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\Factory
的用法示例。
在下文中一共展示了Factory::addExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* 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');
}
示例2: addExtension
/**
* 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);
}
示例3: registerViewFactory
/**
* 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;
});
}