From 12eb5bc0acaf0c45f09e4d8516b5d9338900e878 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 19 Aug 2024 09:31:06 +0200 Subject: [PATCH] up --- Actions/Block/GetAllBlocksAction.php | 10 ++-- Actions/Icon/GetAllIconsAction.php | 2 +- Datas/SliderDataCollection.php | 3 +- Enums/CornerPositionEnum.php | 2 +- Enums/TableLayoutEnum.php | 6 +-- .../Header/TableLayoutToggleHeaderAction.php | 5 +- Filament/Blocks/Image.php | 2 +- Filament/Blocks/ImageSpatie.php | 2 +- Filament/Blocks/ImagesGallery.php | 16 +++---- Filament/Blocks/Slider.php | 2 +- Filament/Blocks/Title.php | 2 +- Filament/Blocks/VideoSpatie.php | 2 +- Filament/Forms/Components/AddressField.php | 4 +- Filament/Forms/Components/IconPicker.php | 46 +++++++++---------- Providers/EventServiceProvider.php | 4 +- View/Components/BreadLink.php | 3 +- View/Components/Logo.php | 3 +- View/Components/Navbar.php | 3 +- View/Components/Page/WithSidebar.php | 3 +- View/Components/Render/Block.php | 2 +- View/Components/Sidebar.php | 3 +- View/Components/Std.php | 3 +- View/Components/Svg.php | 3 +- View/Composers/ThemeComposer.php | 3 +- 24 files changed, 62 insertions(+), 72 deletions(-) diff --git a/Actions/Block/GetAllBlocksAction.php b/Actions/Block/GetAllBlocksAction.php index 8861899c..12993d54 100755 --- a/Actions/Block/GetAllBlocksAction.php +++ b/Actions/Block/GetAllBlocksAction.php @@ -24,11 +24,11 @@ public function execute(string $context = 'form'): DataCollection $blocks = Arr::map($files, function ($path) { $class = Str::of($path) - ->after(base_path('Modules')) - ->prepend('\Modules') - ->before('.php') - ->replace('/', '\\') - ->toString(); + ->after(base_path('Modules')) + ->prepend('\Modules') + ->before('.php') + ->replace('/', '\\') + ->toString(); $name = Str::of(class_basename($class))->snake()->toString(); if (Str::endsWith($name, '_block')) { diff --git a/Actions/Icon/GetAllIconsAction.php b/Actions/Icon/GetAllIconsAction.php index 7f46e03c..f738d845 100755 --- a/Actions/Icon/GetAllIconsAction.php +++ b/Actions/Icon/GetAllIconsAction.php @@ -39,7 +39,7 @@ public function execute(string $context = 'form') foreach ($set['paths'] as $path) { foreach (File::allFiles($path) as $file) { // Simply ignore files that aren't SVGs - if ('svg' !== $file->getExtension()) { + if ($file->getExtension() !== 'svg') { continue; } diff --git a/Datas/SliderDataCollection.php b/Datas/SliderDataCollection.php index 763a4102..b7c1df9d 100755 --- a/Datas/SliderDataCollection.php +++ b/Datas/SliderDataCollection.php @@ -15,6 +15,5 @@ class SliderDataCollection extends Data public DataCollection $slider_data; public function __construct( - ) { - } + ) {} } diff --git a/Enums/CornerPositionEnum.php b/Enums/CornerPositionEnum.php index fdc2d5d3..80d75262 100755 --- a/Enums/CornerPositionEnum.php +++ b/Enums/CornerPositionEnum.php @@ -8,7 +8,7 @@ use Filament\Support\Contracts\HasIcon; use Filament\Support\Contracts\HasLabel; -enum CornerPositionEnum: string implements HasLabel, HasColor, HasIcon +enum CornerPositionEnum: string implements HasColor, HasIcon, HasLabel { case TOP_LEFT = 'top-left'; case TOP_RIGHT = 'top-right'; diff --git a/Enums/TableLayoutEnum.php b/Enums/TableLayoutEnum.php index 039276bb..5711dda4 100755 --- a/Enums/TableLayoutEnum.php +++ b/Enums/TableLayoutEnum.php @@ -10,7 +10,7 @@ use Filament\Support\Contracts\HasLabel; use Illuminate\Support\Arr; -enum TableLayoutEnum: string implements HasLabel, HasColor, HasIcon +enum TableLayoutEnum: string implements HasColor, HasIcon, HasLabel { case GRID = 'grid'; case LIST = 'list'; @@ -50,14 +50,14 @@ public function getIcon(): ?string public function toggle(): self { // $res = self::LIST === $this ? self::GRID : self::LIST; - $res = self::GRID === $this ? self::LIST : self::GRID; + $res = $this === self::GRID ? self::LIST : self::GRID; return $res; } public function isGridLayout(): bool { - return self::GRID === $this; + return $this === self::GRID; } public function getTableContentGrid(): ?array diff --git a/Filament/Actions/Header/TableLayoutToggleHeaderAction.php b/Filament/Actions/Header/TableLayoutToggleHeaderAction.php index be4ff563..04568a89 100755 --- a/Filament/Actions/Header/TableLayoutToggleHeaderAction.php +++ b/Filament/Actions/Header/TableLayoutToggleHeaderAction.php @@ -13,6 +13,7 @@ class TableLayoutToggleHeaderAction extends Action { // use NavigationActionLabelTrait; public string $list_icon = 'heroicon-o-list-bullet'; + public string $grid_icon = 'heroicon-o-squares-2x2'; public static function getDefaultName(): ?string @@ -30,10 +31,10 @@ protected function setUp(): void // ->tooltip(trans('setting::database_connection.actions.database-backup.tooltip')) // ->icon(trans('setting::database_connection.actions.database-backup.icon')) // ->icon($this->list_icon) - ->icon(fn ($livewire) => 'list' == $livewire->layoutView ? $this->list_icon : $this->grid_icon) + ->icon(fn ($livewire) => $livewire->layoutView == 'list' ? $this->list_icon : $this->grid_icon) ->action( function ($livewire) { - $livewire->layoutView = ('grid' == $livewire->layoutView ? 'list' : 'grid'); + $livewire->layoutView = ($livewire->layoutView == 'grid' ? 'list' : 'grid'); } ); } diff --git a/Filament/Blocks/Image.php b/Filament/Blocks/Image.php index aab08505..94e32dd4 100755 --- a/Filament/Blocks/Image.php +++ b/Filament/Blocks/Image.php @@ -35,7 +35,7 @@ public static function make( ->columnSpanFull(), ] ) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } public static function getRatios(): array diff --git a/Filament/Blocks/ImageSpatie.php b/Filament/Blocks/ImageSpatie.php index 64389c1c..cf2615d6 100755 --- a/Filament/Blocks/ImageSpatie.php +++ b/Filament/Blocks/ImageSpatie.php @@ -60,6 +60,6 @@ function (HasForms $livewire, SpatieMediaLibraryFileUpload $component, Temporary TextInput::make('caption') ->label('didascalia'), ]) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } } diff --git a/Filament/Blocks/ImagesGallery.php b/Filament/Blocks/ImagesGallery.php index ac318930..5cd9b87d 100755 --- a/Filament/Blocks/ImagesGallery.php +++ b/Filament/Blocks/ImagesGallery.php @@ -23,15 +23,15 @@ public static function make( SpatieMediaLibraryFileUpload::make('image') // ->image() // ->maxSize(5000) - ->multiple() - ->enableReordering() - ->openable() - ->downloadable() - ->columnSpanFull() + ->multiple() + ->enableReordering() + ->openable() + ->downloadable() + ->columnSpanFull() // ->collection('avatars') // ->conversion('thumbnail') - ->disk('uploads') - ->directory('photos'), + ->disk('uploads') + ->directory('photos'), TextInput::make('title') ->columnSpanFull(), @@ -76,7 +76,7 @@ public static function make( // TextInput::make('caption') // ->columnSpanFull(), ]) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } public static function getRatios(): array diff --git a/Filament/Blocks/Slider.php b/Filament/Blocks/Slider.php index 638223f0..84b1b122 100755 --- a/Filament/Blocks/Slider.php +++ b/Filament/Blocks/Slider.php @@ -32,6 +32,6 @@ public static function make( // ->afterStateHydrated(static fn ($state, $set) => $state || $set('level', 'h2')), ] ) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } } diff --git a/Filament/Blocks/Title.php b/Filament/Blocks/Title.php index f37e1ba8..15d6726a 100755 --- a/Filament/Blocks/Title.php +++ b/Filament/Blocks/Title.php @@ -39,6 +39,6 @@ public static function make( ->options($views), ] ) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } } diff --git a/Filament/Blocks/VideoSpatie.php b/Filament/Blocks/VideoSpatie.php index 6860dbac..7e188c07 100755 --- a/Filament/Blocks/VideoSpatie.php +++ b/Filament/Blocks/VideoSpatie.php @@ -79,7 +79,7 @@ function (HasForms $livewire, SpatieMediaLibraryFileUpload $component, Temporary // Forms\Components\SpatieMediaLibraryFileUpload::make('media_id') ]) - ->columns('form' === $context ? 2 : 1); + ->columns($context === 'form' ? 2 : 1); } public static function getRatios(): array diff --git a/Filament/Forms/Components/AddressField.php b/Filament/Forms/Components/AddressField.php index 507b8211..f9fa13bd 100755 --- a/Filament/Forms/Components/AddressField.php +++ b/Filament/Forms/Components/AddressField.php @@ -29,7 +29,7 @@ public function saveRelationships(): void $record = $this->getRecord(); $relationship = $record?->{$this->getRelationship()}(); - if (null === $relationship) { + if ($relationship === null) { return; } elseif ($address = $relationship->first()) { $address->update($state); @@ -80,7 +80,7 @@ protected function setUp(): void 'zip' => null, ]; $address = $record?->getRelationValue($this->getRelationship()); - if (null != $address && is_object($address) && method_exists($address, 'toArray')) { + if ($address != null && is_object($address) && method_exists($address, 'toArray')) { $data = $address->toArray(); } diff --git a/Filament/Forms/Components/IconPicker.php b/Filament/Forms/Components/IconPicker.php index e974a77b..5097ec79 100755 --- a/Filament/Forms/Components/IconPicker.php +++ b/Filament/Forms/Components/IconPicker.php @@ -40,31 +40,31 @@ protected function setUp(): void $this->suffixAction( \Filament\Forms\Components\Actions\Action::make('icon') - ->icon(fn (?string $state) => $state) + ->icon(fn (?string $state) => $state) // ->modalContent(fn ($record) => view('ui::filament.forms.components.icon-picker', ['record' => $record])) - ->form([ - Select::make('pack') - ->options($packs) - ->reactive() - ->live(), - RadioIcon::make('newstate') - ->options(function (Get $get) use ($icons): array { - $pack = $get('pack'); - if (null == $pack) { - return []; - } - $key = $pack.'.icons'; - Assert::isArray($opts = Arr::get($icons, $key, []), '['.__LINE__.']['.__FILE__.']'); - $opts = array_combine($opts, $opts); + ->form([ + Select::make('pack') + ->options($packs) + ->reactive() + ->live(), + RadioIcon::make('newstate') + ->options(function (Get $get) use ($icons): array { + $pack = $get('pack'); + if ($pack == null) { + return []; + } + $key = $pack.'.icons'; + Assert::isArray($opts = Arr::get($icons, $key, []), '['.__LINE__.']['.__FILE__.']'); + $opts = array_combine($opts, $opts); - return $opts; - }) - ->inline() - ->inlineLabel(false), - ]) - ->action(function ($data, $set) { - $set('icon', $data['newstate']); - }) + return $opts; + }) + ->inline() + ->inlineLabel(false), + ]) + ->action(function ($data, $set) { + $set('icon', $data['newstate']); + }) ); } } diff --git a/Providers/EventServiceProvider.php b/Providers/EventServiceProvider.php index 04ddc91e..28756b63 100755 --- a/Providers/EventServiceProvider.php +++ b/Providers/EventServiceProvider.php @@ -25,7 +25,5 @@ class EventServiceProvider extends BaseEventServiceProvider /** * Configure the proper event listeners for email verification. */ - protected function configureEmailVerification(): void - { - } + protected function configureEmailVerification(): void {} } diff --git a/View/Components/BreadLink.php b/View/Components/BreadLink.php index c1177a44..53a64ed6 100755 --- a/View/Components/BreadLink.php +++ b/View/Components/BreadLink.php @@ -19,8 +19,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Components/Logo.php b/View/Components/Logo.php index 359b5502..0cc7e44e 100755 --- a/View/Components/Logo.php +++ b/View/Components/Logo.php @@ -19,8 +19,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Components/Navbar.php b/View/Components/Navbar.php index 782130f0..341c847c 100755 --- a/View/Components/Navbar.php +++ b/View/Components/Navbar.php @@ -19,8 +19,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, // public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Components/Page/WithSidebar.php b/View/Components/Page/WithSidebar.php index 76cdd681..04438c7c 100755 --- a/View/Components/Page/WithSidebar.php +++ b/View/Components/Page/WithSidebar.php @@ -14,8 +14,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Components/Render/Block.php b/View/Components/Render/Block.php index e97d8fed..be2d3f01 100755 --- a/View/Components/Render/Block.php +++ b/View/Components/Render/Block.php @@ -35,7 +35,7 @@ public function render(): ViewFactory|View return view('ui::empty'); } - if ('v1' === $this->tpl) { + if ($this->tpl === 'v1') { $this->tpl = $this->block['type']; } else { $this->tpl = $this->block['type'].'.'.$this->tpl; diff --git a/View/Components/Sidebar.php b/View/Components/Sidebar.php index a5b4de4e..0c1352b3 100755 --- a/View/Components/Sidebar.php +++ b/View/Components/Sidebar.php @@ -14,8 +14,7 @@ class Sidebar extends Component public function __construct( public Collection $collection, // public string $tpl = 'v1' - ) { - } + ) {} /** * Get the view / contents that represent the component. diff --git a/View/Components/Std.php b/View/Components/Std.php index 51f0b78c..cbda8bae 100755 --- a/View/Components/Std.php +++ b/View/Components/Std.php @@ -19,8 +19,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Components/Svg.php b/View/Components/Svg.php index e16ae52d..ace29648 100755 --- a/View/Components/Svg.php +++ b/View/Components/Svg.php @@ -19,8 +19,7 @@ public function __construct( // public Post $article, // public bool $showAuthor = false, public string $tpl = 'v1' - ) { - } + ) {} public function render(): Renderable { diff --git a/View/Composers/ThemeComposer.php b/View/Composers/ThemeComposer.php index 67779871..bdf97619 100755 --- a/View/Composers/ThemeComposer.php +++ b/View/Composers/ThemeComposer.php @@ -17,8 +17,7 @@ public function metatags(): \Illuminate\View\View } /** - * @param string $index - * + * @param string $index * @return \Illuminate\Config\Repository|\Illuminate\Contracts\Foundation\Application|mixed */ public function metatag($index)