Fix binding.

This commit is contained in:
James Cole
2017-04-29 08:55:37 +02:00
parent 78faf7e14c
commit a0e7be9d45

View File

@@ -55,6 +55,7 @@ use Illuminate\Support\ServiceProvider;
use Twig; use Twig;
use TwigBridge\Extension\Loader\Functions; use TwigBridge\Extension\Loader\Functions;
use Validator; use Validator;
use Illuminate\Foundation\Application;
/** /**
* Class FireflyServiceProvider * Class FireflyServiceProvider
@@ -123,7 +124,18 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind(GeneratorInterface::class, ChartJsGenerator::class); $this->app->bind(GeneratorInterface::class, ChartJsGenerator::class);
// chart builder // chart builder
$this->app->bind(MetaPieChartInterface::class, MetaPieChart::class); $this->app->bind(
MetaPieChartInterface::class,
function (Application $app) {
/** @var MetaPieChart $chart */
$chart = app(MetaPieChart::class);
if ($app->auth->check()) {
$chart->setUser(auth()->user());
}
return $chart;
}
);
// other generators // other generators
$this->app->bind(ProcessorInterface::class, Processor::class); $this->app->bind(ProcessorInterface::class, Processor::class);