fn () => search( label: 'Search for a theme:', placeholder: 'default-theme', options: fn (string $value): array => \collect(File::directories(\resource_path('theme'))) ->map(fn (string $dir_path) => \pathinfo($dir_path, \PATHINFO_BASENAME)) ->filter(fn (string $dir_path) => $value ? Str::of($dir_path)->contains($value) : true) ->filter(fn (string $dir_path) => $dir_path !== 'mounted') ->all() ) ]; } /** * Execute the console command. * * @return void */ public function handle(): void { $mount_path = \resource_path('theme/mounted'); /** @var string */ $theme = $this->argument('theme'); if (File::exists($mount_path)) { \throw_if( empty(ToolboxHelper::runConsoleCommand("readlink {$mount_path}", false)), "{$mount_path} is not a link, cannot remove it" ); \throw_if( !File::delete($mount_path), "{$mount_path} Failed to remove file" ); } File::link(\resource_path("theme/{$theme}"), $mount_path); Artisan::call('optimize:clear'); } }