src/Console/InstallCommand.php
protected function registerTelescopeServiceProvider()
    {
        $namespace = str_replace_last('\\', '', $this->getAppNamespace());

        $appConfig = file_get_contents(config_path('app.php'));

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

        $lineEndingCount = [
            "\r\n" => substr_count($appConfig, "\r\n"),
            "\r" => substr_count($appConfig, "\r"),
            "\n" => substr_count($appConfig, "\n"),
        ];

        $eol = array_keys($lineEndingCount, max($lineEndingCount))[0];

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

        file_put_contents(app_path('Providers/TelescopeServiceProvider.php'), str_replace(
            "namespace App\Providers;",
            "namespace {$namespace}\Providers;",
            file_get_contents(app_path('Providers/TelescopeServiceProvider.php'))
        ));
    }
protected function registerTelescopeServiceProvider()
    {
        $namespace = str_replace_last('\\', '', $this->getAppNamespace());

        $appConfig = file_get_contents(config_path('app.php'));

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

        $lineEndingCount = [
            "\r\n" => substr_count($appConfig, "\r\n"),
            "\r" => substr_count($appConfig, "\r"),
            "\n" => substr_count($appConfig, "\n"),
        ];

        $eol = array_keys($lineEndingCount, max($lineEndingCount))[0];

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

        file_put_contents(app_path('Providers/TelescopeServiceProvider.php'), str_replace(
            "namespace App\Providers;",
            "namespace {$namespace}\Providers;",
            file_get_contents(app_path('Providers/TelescopeServiceProvider.php'))
        ));
    }
protected function registerTelescopeServiceProvider ( ) { $ namespace = str_replace_last ( '\\' , '' , $ this -> getAppNamespace ( ) ) ; $ appConfig = file_get_contents ( config_path ( 'app.php' ) ) ; if ( Str :: contains ( $ appConfig , $ namespace . '\\Providers\\TelescopeServiceProvider::class' ) ) { return ; } $ lineEndingCount = [ "\r\n" => substr_count ( $ appConfig , "\r\n" ) , "\r" => substr_count ( $ appConfig , "\r" ) , "\n" => substr_count ( $ appConfig , "\n" ) , ] ; $ eol = array_keys ( $ lineEndingCount , max ( $ lineEndingCount ) ) [ 0 ] ; file_put_contents ( config_path ( 'app.php' ) , str_replace ( "{$namespace}\\Providers\EventServiceProvider::class," . $ eol , "{$namespace}\\Providers\EventServiceProvider::class," . $ eol . "        {$namespace}\Providers\TelescopeServiceProvider::class," . $ eol , $ appConfig ) ) ; file_put_contents ( app_path ( 'Providers/TelescopeServiceProvider.php' ) , str_replace ( "namespace App\Providers;" , "namespace {$namespace}\Providers;" , file_get_contents ( app_path ( 'Providers/TelescopeServiceProvider.php' ) ) ) ) ; }
Register the Telescope service provider in the application configuration file.

@return void
Register the Telescope service provider in the application configuration file .