/** {@inheritDoc} */ public function register() { /** @var \Illuminate\Foundation\Application $app */ $app = parent::register(); $config = array_dot($this->app['config']['blade_extensions']); if ($config['example_views'] === true) { $this->viewDirs = ['views' => 'blade-ext']; } AssignmentDirectives::attach($app); DebugDirectives::attach($app); ForeachDirectives::attach($app); EmbeddingDirectives::attach($app); MacroDirectives::attach($app); MinifyDirectives::attach($app); # Optional markdown compiler, engines and directives if ($config['markdown.enabled']) { if (!class_exists($config['markdown.renderer'])) { throw new Exception('The configured markdown renderer class does not exist'); } $app->bind('Radic\\BladeExtensions\\Contracts\\MarkdownRenderer', $config['markdown.renderer']); $app->singleton('markdown', function (Application $app) { return $app->make('Radic\\BladeExtensions\\Contracts\\MarkdownRenderer'); }); $app->singleton('markdown.compiler', function (Application $app) { $markdownRenderer = $app->make('markdown'); $files = $app->make('files'); $storagePath = $app['config']->get('view.compiled'); return new MarkdownCompiler($markdownRenderer, $files, $storagePath); }); MarkdownDirectives::attach($app); } }
/** {@inheritDoc} */ public function register() { /** @var \Illuminate\Foundation\Application $app */ $app = parent::register(); $config = $app->make('config'); AssignmentDirectives::attach($app); DebugDirectives::attach($app); ForeachDirectives::attach($app); PartialDirectives::attach($app); $app->booting(function () use($app) { if (array_key_exists('form', App::getBindings())) { MacroDirectives::attach($app); } }); # Optional markdown compiler, engines and directives if ($config->get('blade_extensions.markdown.enabled')) { if (!class_exists($config->get('blade_extensions.markdown.renderer'))) { throw new Exception('The configured markdown renderer class does not exist'); } $app->register('Radic\\BladeExtensions\\Providers\\MarkdownServiceProvider'); } $app->bind('blade.string', 'Radic\\BladeExtensions\\Renderers\\BladeStringRenderer'); }