diff --git a/resources/views/components/page-blocks.blade.php b/resources/views/components/page-blocks.blade.php index 49d2083..188f4d2 100644 --- a/resources/views/components/page-blocks.blade.php +++ b/resources/views/components/page-blocks.blade.php @@ -1,14 +1,16 @@ @props(['blocks' => []]) -@foreach ($blocks as $blockData) - @php - $pageBlock = \MartinRo\FilamentPageBlocks\Facades\FilamentPageBlocks::getPageBlockFromName($blockData['type']) - @endphp +@if(is_array($blocks)) + @foreach ($blocks as $blockData) + @php + $pageBlock = \MartinRo\FilamentPageBlocks\Facades\FilamentPageBlocks::getPageBlockFromName($blockData['type']) + @endphp - @isset($pageBlock) - - @endisset -@endforeach + @isset($pageBlock) + + @endisset + @endforeach +@endif diff --git a/src/Commands/MakePageBlockCommand.php b/src/Commands/MakePageBlockCommand.php index 3a856b9..e6a43bf 100644 --- a/src/Commands/MakePageBlockCommand.php +++ b/src/Commands/MakePageBlockCommand.php @@ -72,7 +72,7 @@ public function handle(): int $this->copyStubToApp('PageBlock', $path, [ 'class' => $pageBlockClass, - 'namespace' => 'App\\Filament\\PageBlocks' . ($pageBlockNamespace !== '' ? "\\{$pageBlockNamespace}" : ''), + 'namespace' => 'App\\Filament\\PageBlocks'.($pageBlockNamespace !== '' ? "\\{$pageBlockNamespace}" : ''), 'label' => $label, 'shortName' => $shortName, ]); diff --git a/src/FilamentPageBlocksManager.php b/src/FilamentPageBlocksManager.php index badeeeb..bdf283e 100644 --- a/src/FilamentPageBlocksManager.php +++ b/src/FilamentPageBlocksManager.php @@ -37,7 +37,7 @@ public function register(string $class, string $baseClass): void public function registerPageBlock(string $pageBlock): void { if (! is_subclass_of($pageBlock, PageBlock::class)) { - throw new InvalidArgumentException("{$pageBlock} must extend " . PageBlock::class); + throw new InvalidArgumentException("{$pageBlock} must extend ".PageBlock::class); } $this->pageBlocks->put($pageBlock::getName(), $pageBlock); diff --git a/src/FilamentPageBlocksServiceProvider.php b/src/FilamentPageBlocksServiceProvider.php index a8765a9..463e8ce 100644 --- a/src/FilamentPageBlocksServiceProvider.php +++ b/src/FilamentPageBlocksServiceProvider.php @@ -61,7 +61,7 @@ protected function registerComponentsFromDirectory(string $baseClass, array $reg collect($filesystem->allFiles($directory)) ->map(function (SplFileInfo $file) use ($namespace): string { $variableNamespace = $namespace->contains('*') ? str_ireplace( - ['\\' . $namespace->before('*'), $namespace->after('*')], + ['\\'.$namespace->before('*'), $namespace->after('*')], ['', ''], Str::of($file->getPath()) ->after(base_path()) diff --git a/src/PageBlock.php b/src/PageBlock.php index cca6879..37d0321 100644 --- a/src/PageBlock.php +++ b/src/PageBlock.php @@ -16,7 +16,7 @@ public static function getComponent(): string return static::$component; } - return 'page-blocks.' . static::getName(); + return 'page-blocks.'.static::getName(); } public static function getName(): string