Skip to content

Commit

Permalink
Merge pull request #4 from fridzema/patch-1
Browse files Browse the repository at this point in the history
Update to BladeCompiler
  • Loading branch information
denisdulici authored Feb 6, 2018
2 parents 159533e + d682378 commit c8efd04
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Akaunting\Money;

use Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\BladeCompiler;

class Provider extends ServiceProvider
{
Expand All @@ -22,12 +22,16 @@ public function boot()
Currency::setCurrencies($this->app->make('config')->get('money'));

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

Blade::directive('currency', function ($expression) {
return "<?php echo currency($expression); ?>";
$this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
$bladeCompiler->directive('currency', function ($expression) {
return "<?php echo currency($expression); ?>";
});
});
}

Expand Down

0 comments on commit c8efd04

Please sign in to comment.