mergeConfigFrom($this->getConfigPath(), 'unleash'); $this->app->when(Unleash::class)->needs(ClientInterface::class)->give(Client::class); $this->app->singleton('unleash', function ($app) { return $app->make(Unleash::class); }); } /** * Perform post-registration booting of services. * * @return void */ public function boot() { $this->publishes( [ $this->getConfigPath() => config_path('unleash.php'), ] ); Blade::if( 'featureEnabled', function (string $feature) { $client = app(Client::class); $unleash = app(Unleash::class, ['client' => $client]); return $unleash->isFeatureEnabled($feature); } ); Blade::if( 'featureDisabled', function (string $feature) { $client = app(Client::class); $unleash = app(Unleash::class, ['client' => $client]); return !$unleash->isFeatureEnabled($feature); } ); } /** * Get the path to the config. * * @return string */ private function getConfigPath(): string { return __DIR__ . '/../config/unleash.php'; } }