コード例 #1
0
 /** {@inheritdoc} */
 public function register()
 {
     $this->app->bind('Radic\\BladeExtensions\\Contracts\\MarkdownRenderer', Config::get('blade_extensions.markdown.renderer'));
     $this->app->singleton('markdown', function ($app) {
         return $this->app->make('Radic\\BladeExtensions\\Contracts\\MarkdownRenderer');
     });
     $this->app->singleton('markdown.compiler', function ($app) {
         $markdownRenderer = $app['markdown'];
         $files = $app['files'];
         $storagePath = Config::get('view.compiled');
         return new MarkdownCompiler($markdownRenderer, $files, $storagePath);
     });
     MarkdownDirectives::attach($this->app);
 }
コード例 #2
0
 /** {@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);
     }
 }