From ef58de081c88d27ea0ea4a9b7dc0d59156a5b5ef Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 20 Mar 2024 23:29:41 +0300 Subject: [PATCH] wip --- src/Console/InstallCommand.php | 28 ++++++++++++++-------------- stubs/Models/User.php | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 11d0d9c..6172d40 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -25,17 +25,17 @@ public function handle(): void $this->info('publishing stubs files...'); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/css', resource_path('/css')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/views', resource_path('/views')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/routes', base_path('/routes')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/config', base_path('/config')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/Filament', app_path('/Providers/Filament')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/seeders', base_path('/database/seeders')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/Models', app_path('/Models')); - (new Filesystem)->copy(__DIR__.'/../../stubs/package.json', base_path('package.json')); - (new Filesystem)->copy(__DIR__.'/../../stubs/vite.config.js', base_path('vite.config.js')); - (new Filesystem)->copy(__DIR__.'/../../stubs/postcss.config.js', base_path('postcss.config.js')); - (new Filesystem)->copy(__DIR__.'/../../stubs/AppServiceProvider.php', app_path('/Providers/AppServiceProvider.php')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/css', resource_path('/css')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/views', resource_path('/views')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/routes', base_path('/routes')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/config', base_path('/config')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/Filament', app_path('/Providers/Filament')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/seeders', base_path('/database/seeders')); + (new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/Models', app_path('/Models')); + (new Filesystem)->copy(__DIR__ . '/../../stubs/package.json', base_path('package.json')); + (new Filesystem)->copy(__DIR__ . '/../../stubs/vite.config.js', base_path('vite.config.js')); + (new Filesystem)->copy(__DIR__ . '/../../stubs/postcss.config.js', base_path('postcss.config.js')); + (new Filesystem)->copy(__DIR__ . '/../../stubs/AppServiceProvider.php', app_path('/Providers/AppServiceProvider.php')); $this->registerPnaelProviders(); @@ -48,18 +48,18 @@ private function registerPnaelProviders(): void /** @phpstan-ignore-next-line */ file_exists($bootstrapProvidersPath = App::getBootstrapProvidersPath()); - foreach (['AdminPanelProvider','CompanyPanelProvider'] as $item) { + foreach (['AdminPanelProvider', 'CompanyPanelProvider'] as $item) { if ($isLaravel11OrHigherWithBootstrapProvidersFile) { /** @phpstan-ignore-next-line */ ServiceProvider::addProviderToBootstrapFile( - "App\\Providers\\Filament\\".$item, + 'App\\Providers\\Filament\\' . $item, /** @phpstan-ignore-next-line */ $bootstrapProvidersPath, ); } else { $appConfig = file_get_contents(config_path('app.php')); - if (! Str::contains($appConfig, "App\\Providers\\Filament\\AdminPanelProvider}::class")) { + if (! Str::contains($appConfig, 'App\\Providers\\Filament\\AdminPanelProvider}::class')) { file_put_contents(config_path('app.php'), str_replace( 'App\\Providers\\RouteServiceProvider::class,', "App\\Providers\\Filament\\{$item}::class," . PHP_EOL . ' App\\Providers\\RouteServiceProvider::class,', diff --git a/stubs/Models/User.php b/stubs/Models/User.php index 8b9f4a4..f439e7b 100644 --- a/stubs/Models/User.php +++ b/stubs/Models/User.php @@ -40,6 +40,7 @@ class User extends Authenticatable implements FilamentUser, HasAvatar, HasDefaul use ChaosModel; use ForFilament; use HasCompanies; + /*use HasPlanSubscriptions;*/ use HasRoles; use HasTranslations;