Skip to content

Commit

Permalink
Make sure the blade compiler is registered immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Jan 3, 2020
1 parent 6f7e1a3 commit acc438e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/Illuminate/View/ViewServiceProvider.php
Expand Up @@ -22,6 +22,8 @@ public function register()

$this->registerViewFinder();

$this->registerBladeCompiler();

$this->registerEngineResolver();
}

Expand Down Expand Up @@ -78,6 +80,20 @@ public function registerViewFinder()
});
}

/**
* Register the Blade compiler implementation.
*
* @return void
*/
public function registerBladeCompiler()
{
$this->app->singleton('blade.compiler', function () {
return new BladeCompiler(
$this->app['files'], $this->app['config']['view.compiled']
);
});
}

/**
* Register the engine resolver instance.
*
Expand Down Expand Up @@ -133,15 +149,6 @@ public function registerPhpEngine($resolver)
*/
public function registerBladeEngine($resolver)
{
// The Compiler engine requires an instance of the CompilerInterface, which in
// this case will be the Blade compiler, so we'll first create the compiler
// instance to pass into the engine so it can compile the views properly.
$this->app->singleton('blade.compiler', function () {
return new BladeCompiler(
$this->app['files'], $this->app['config']['view.compiled']
);
});

$resolver->register('blade', function () {
return new CompilerEngine($this->app['blade.compiler']);
});
Expand Down

0 comments on commit acc438e

Please sign in to comment.