Skip to content

Commit

Permalink
register blade directive after resolving compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici authored Sep 23, 2022
1 parent 67bbadd commit 598cacc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Akaunting\Setting;

use Akaunting\Setting\Middleware\AutoSaveSetting;
use Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Arr;
use Illuminate\View\Compilers\BladeCompiler;

class Provider extends ServiceProvider
{
Expand All @@ -30,8 +30,10 @@ public function boot()
$this->override();

// Register blade directive
Blade::directive('setting', function ($expression) {
return "<?php echo setting($expression); ?>";
$this->callAfterResolving('blade.compiler', function (BladeCompiler $compiler) {
$compiler->directive('setting', function ($expression) {
return "<?php echo setting($expression); ?>";
});
});
}

Expand Down

1 comment on commit 598cacc

@beschoenen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke the package for me, ServiceProvider::callAfterResolving is only available on Laravel ^6.

Please sign in to comment.