本文整理汇总了PHP中Illuminate\Contracts\View\Factory::getEngineResolver方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getEngineResolver方法的具体用法?PHP Factory::getEngineResolver怎么用?PHP Factory::getEngineResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\View\Factory
的用法示例。
在下文中一共展示了Factory::getEngineResolver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupBlade
/**
* Setup the blade compiler class.
*
* @param \Illuminate\Contracts\View\Factory $view
*
* @return void
*/
protected function setupBlade(View $view)
{
$blade = $view->getEngineResolver()->resolve('blade')->getCompiler();
$blade->directive('auth', function ($expression) {
return "<?php if (\\GrahamCampbell\\Credentials\\Facades\\Credentials::check() && \\GrahamCampbell\\Credentials\\Facades\\Credentials::hasAccess{$expression}): ?>";
});
$blade->directive('endauth', function () {
return '<?php endif; ?>';
});
}
示例2: setupBlade
/**
* Setup the blade compiler class.
*
* @param \Illuminate\Contracts\View\Factory $view
*
* @return void
*/
protected function setupBlade(View $view)
{
$blade = $view->getEngineResolver()->resolve('blade')->getCompiler();
$blade->extend(function ($value, $compiler) {
$pattern = $compiler->createMatcher('auth');
$replace = '$1<?php if (\\App\\Facades\\Credentials::check() && \\App\\Facades\\Credentials::hasAccess$2): ?>';
return preg_replace($pattern, $replace, $value);
});
$blade->extend(function ($value, $compiler) {
$pattern = $compiler->createPlainMatcher('endauth');
$replace = '$1<?php endif; ?>$2';
return preg_replace($pattern, $replace, $value);
});
}
示例3: boot
/**
* boot.
*
* @method boot
*
* @param \Illuminate\Contracts\Http\Kernel $kernel
* @param \Illuminate\Contracts\View\Factory $view
*/
public function boot(Kernel $kernel, View $view)
{
if ($this->app->runningInConsole() === true) {
$this->publishes([__DIR__ . '/../config/tracy.php' => $this->app->configPath() . '/tracy.php'], 'config');
return;
}
if ($this->app['config']['tracy']['enabled'] === true) {
$this->app->extend(ExceptionHandler::class, function ($exceptionHandler, $app) {
return $app->make(Handler::class, ['exceptionHandler' => $exceptionHandler]);
});
$kernel->prependMiddleware(Dispatch::class);
}
$view->getEngineResolver()->resolve('blade')->getCompiler()->directive('bdump', function ($expression) {
return "<?php \\Tracy\\Debugger::barDump({$expression}); ?>";
});
}