argument('name') ?? text( label: 'What is the layout name?', placeholder: 'Wizard', required: true, )) ->trim('/') ->trim('\\') ->trim(' ') ->replace('/', '\\'); $componentClass = (string) str($component)->afterLast('\\'); $componentNamespace = str($component)->contains('\\') ? (string) str($component)->beforeLast('\\') : ''; $view = str($component) ->prepend('infolists\\components\\') ->explode('\\') ->map(fn ($segment) => Str::kebab($segment)) ->implode('.'); $path = app_path( (string) str($component) ->prepend('Infolists\\Components\\') ->replace('\\', '/') ->append('.php'), ); $viewPath = resource_path( (string) str($view) ->replace('.', '/') ->prepend('views/') ->append('.blade.php'), ); if (! $this->option('force') && $this->checkForCollision([ $path, ])) { return static::INVALID; } $this->copyStubToApp('LayoutComponent', $path, [ 'class' => $componentClass, 'namespace' => 'App\\Infolists\\Components' . ($componentNamespace !== '' ? "\\{$componentNamespace}" : ''), 'view' => $view, ]); if (! $this->fileExists($viewPath)) { $this->copyStubToApp('LayoutComponentView', $viewPath); } $this->components->info("Filament infolist layout component [{$path}] created successfully."); return static::SUCCESS; } }