Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Mar 20, 2024
1 parent eb931b7 commit ef58de0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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,',
Expand Down
1 change: 1 addition & 0 deletions stubs/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class User extends Authenticatable implements FilamentUser, HasAvatar, HasDefaul
use ChaosModel;
use ForFilament;
use HasCompanies;

/*use HasPlanSubscriptions;*/
use HasRoles;
use HasTranslations;
Expand Down

0 comments on commit ef58de0

Please sign in to comment.