Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Oct 29, 2018
1 parent 1ed9ff4 commit 9848d07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,24 @@ public function handle()
*/
protected function registerTelescopeServiceProvider()
{
$appNamespace = $this->getAppNamespace();
$namespace = str_replace_last('\\', '', $this->getAppNamespace());

$appConfig = file_get_contents(config_path('app.php'));
$serviceProvider = file_get_contents(app_path('Providers/TelescopeServiceProvider.php'));

if (Str::contains($appConfig, $appNamespace."Providers\TelescopeServiceProvider::class")) {
if (Str::contains($appConfig, $namespace."Providers\\TelescopeServiceProvider::class")) {
return;
}

file_put_contents(config_path('app.php'), str_replace(
$appNamespace."Providers\EventServiceProvider::class,".PHP_EOL,
$appNamespace."Providers\EventServiceProvider::class,".PHP_EOL." ".$appNamespace."Providers\TelescopeServiceProvider::class,".PHP_EOL,
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\TelescopeServiceProvider::class,".PHP_EOL,
$appConfig
));

file_put_contents(app_path('Providers/TelescopeServiceProvider.php'), str_replace(
"namespace App\Providers;",
"namespace ".$appNamespace."Providers;",
$serviceProvider
"namespace {$namespace}\Providers;",
file_get_contents(app_path('Providers/TelescopeServiceProvider.php'))
));
}
}

0 comments on commit 9848d07

Please sign in to comment.