From 67f4cd83ce88868dd479c6fc2ca20aa86aeda88b Mon Sep 17 00:00:00 2001 From: Kyrch Date: Sun, 9 Jun 2024 19:42:04 -0300 Subject: [PATCH] refactor(filament): relation managers (#696) --- .../Components/Columns/TextColumn.php | 4 +- .../Components/Filters/DateFilter.php | 26 +---- .../Components/Filters/NumberFilter.php | 26 +---- .../Components/Filters/TextFilter.php | 21 +--- .../Components/Infolist/TextEntry.php | 3 +- .../Auth/PermissionRelationManager.php | 104 +++++++++++++++++ .../Auth/RoleRelationManager.php | 107 +++++++++++++++++ .../Auth/UserRelationManager.php | 107 +++++++++++++++++ .../BaseRelationManager.php | 49 ++------ .../List/Playlist/TrackRelationManager.php | 110 ++++++++++++++++++ .../List/PlaylistRelationManager.php | 110 ++++++++++++++++++ .../Wiki/Anime/SynonymRelationManager.php | 110 ++++++++++++++++++ .../Wiki/Anime/Theme/EntryRelationManager.php | 110 ++++++++++++++++++ .../Wiki/Anime/ThemeRelationManager.php | 110 ++++++++++++++++++ .../Wiki/AnimeRelationManager.php | 110 ++++++++++++++++++ .../Wiki/ArtistRelationManager.php | 110 ++++++++++++++++++ .../Wiki/ImageRelationManager.php | 110 ++++++++++++++++++ .../Wiki/ResourceRelationManager.php | 110 ++++++++++++++++++ .../Wiki/SeriesRelationManager.php | 110 ++++++++++++++++++ .../Wiki/SongRelationManager.php | 110 ++++++++++++++++++ .../Wiki/StudioRelationManager.php | 110 ++++++++++++++++++ .../Wiki/Video/ScriptRelationManager.php | 110 ++++++++++++++++++ .../Wiki/VideoRelationManager.php | 110 ++++++++++++++++++ app/Filament/Resources/Auth/Permission.php | 1 + .../RolePermissionRelationManager.php | 39 ++----- .../UserPermissionRelationManager.php | 37 ++---- app/Filament/Resources/Auth/Role.php | 3 +- .../PermissionRoleRelationManager.php | 41 ++----- .../UserRoleRelationManager.php | 24 +--- .../PermissionUserRelationManager.php | 41 ++----- .../PlaylistUserRelationManager.php | 24 +--- .../RoleUserRelationManager.php | 42 +++---- app/Filament/Resources/BaseResource.php | 9 +- .../ImagePlaylistRelationManager.php | 30 +---- .../TrackPlaylistRelationManager.php | 28 +---- app/Filament/Resources/Wiki/Anime.php | 3 +- .../ImageAnimeRelationManager.php | 28 +---- .../ResourceAnimeRelationManager.php | 28 +---- .../SeriesAnimeRelationManager.php | 28 +---- .../StudioAnimeRelationManager.php | 28 +---- .../SynonymAnimeRelationManager.php | 28 +---- .../ThemeAnimeRelationManager.php | 28 +---- app/Filament/Resources/Wiki/Anime/Synonym.php | 4 +- app/Filament/Resources/Wiki/Anime/Theme.php | 7 +- .../Resources/Wiki/Anime/Theme/Entry.php | 14 +-- .../VideoEntryRelationManager.php | 27 +---- .../EntryThemeRelationManager.php | 28 +---- .../GroupArtistRelationManager.php | 28 +---- .../ImageArtistRelationManager.php | 28 +---- .../MemberArtistRelationManager.php | 28 +---- .../ResourceArtistRelationManager.php | 28 +---- .../SongArtistRelationManager.php | 28 +---- app/Filament/Resources/Wiki/Audio.php | 4 +- .../VideoAudioRelationManager.php | 29 +---- .../Resources/Wiki/ExternalResource.php | 9 +- .../AnimeResourceRelationManager.php | 28 +---- .../ArtistResourceRelationManager.php | 28 +---- .../SongResourceRelationManager.php | 28 +---- .../StudioResourceRelationManager.php | 28 +---- .../ThemeGroupRelationManager.php | 28 +---- .../AnimeImageRelationManager.php | 28 +---- .../ArtistImageRelationManager.php | 28 +---- .../PlaylistImageRelationManager.php | 28 +---- .../StudioImageRelationManager.php | 28 +---- .../AnimeSeriesRelationManager.php | 28 +---- .../ArtistSongRelationManager.php | 28 +---- .../ResourceSongRelationManager.php | 28 +---- .../ThemeSongRelationManager.php | 28 +---- .../AnimeStudioRelationManager.php | 28 +---- .../ImageStudioRelationManager.php | 28 +---- .../ResourceStudioRelationManager.php | 28 +---- app/Filament/Resources/Wiki/Video.php | 6 +- .../EntryVideoRelationManager.php | 28 +---- .../ScriptVideoRelationManager.php | 32 ++--- .../TrackVideoRelationManager.php | 28 +---- .../Video/Script/UploadScriptTableAction.php | 2 +- .../Wiki/Video/UploadVideoTableAction.php | 2 +- app/Filament/Widgets/BaseChartWidget.php | 3 +- app/Filament/Widgets/BaseStatsWidget.php | 1 + .../Jobs/Discord/DiscordThreadTest.php | 3 + 80 files changed, 2127 insertions(+), 1165 deletions(-) create mode 100644 app/Filament/RelationManagers/Auth/PermissionRelationManager.php create mode 100644 app/Filament/RelationManagers/Auth/RoleRelationManager.php create mode 100644 app/Filament/RelationManagers/Auth/UserRelationManager.php rename app/Filament/{Resources => RelationManagers}/BaseRelationManager.php (71%) create mode 100644 app/Filament/RelationManagers/List/Playlist/TrackRelationManager.php create mode 100644 app/Filament/RelationManagers/List/PlaylistRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/Anime/SynonymRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/Anime/Theme/EntryRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/Anime/ThemeRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/AnimeRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/ArtistRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/ImageRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/ResourceRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/SeriesRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/SongRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/StudioRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/Video/ScriptRelationManager.php create mode 100644 app/Filament/RelationManagers/Wiki/VideoRelationManager.php diff --git a/app/Filament/Components/Columns/TextColumn.php b/app/Filament/Components/Columns/TextColumn.php index 362dc9dea..6767b9dc3 100644 --- a/app/Filament/Components/Columns/TextColumn.php +++ b/app/Filament/Components/Columns/TextColumn.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace App\Filament\Components\Columns; -use App\Filament\Resources\BaseRelationManager; use App\Filament\Resources\BaseResource; use App\Models\BaseModel; use Filament\Support\Enums\FontWeight; @@ -57,6 +56,7 @@ class TextColumn extends ColumnsTextColumn { return $this ->copyable($condition) - ->copyMessage(__('filament.actions.base.copied')); + ->copyMessage(__('filament.actions.base.copied')) + ->icon('heroicon-o-clipboard'); } } \ No newline at end of file diff --git a/app/Filament/Components/Filters/DateFilter.php b/app/Filament/Components/Filters/DateFilter.php index 2fb6f8eb9..87c4a2e85 100644 --- a/app/Filament/Components/Filters/DateFilter.php +++ b/app/Filament/Components/Filters/DateFilter.php @@ -15,23 +15,9 @@ use Illuminate\Support\Arr; */ class DateFilter extends Filter { - protected string $attribute = ''; protected string $fromLabel = ''; protected string $toLabel = ''; - /** - * Get the attribute used for filter. - * - * @param string $attribute - * @return static - */ - public function attribute(string $attribute): static - { - $this->attribute = $attribute; - - return $this; - } - /** * Get the label for the filters. * @@ -55,10 +41,10 @@ class DateFilter extends Filter public function getFormSchema(): array { return [ - DatePicker::make($this->attribute.'_'.'from') + DatePicker::make($this->getName().'_'.'from') ->label($this->fromLabel), - DatePicker::make($this->attribute.'_'.'to') + DatePicker::make($this->getName().'_'.'to') ->label($this->toLabel), ]; } @@ -74,12 +60,12 @@ class DateFilter extends Filter { return $query ->when( - Arr::get($data, $this->attribute.'_'.'from'), - fn (Builder $query, $date): Builder => $query->whereDate($this->attribute, ComparisonOperator::GTE->value, $date), + Arr::get($data, $this->getName().'_'.'from'), + fn (Builder $query, $date): Builder => $query->whereDate($this->getName(), ComparisonOperator::GTE->value, $date), ) ->when( - Arr::get($data, $this->attribute.'_'.'to'), - fn (Builder $query, $date): Builder => $query->whereDate($this->attribute, ComparisonOperator::LTE->value, $date), + Arr::get($data, $this->getName().'_'.'to'), + fn (Builder $query, $date): Builder => $query->whereDate($this->getName(), ComparisonOperator::LTE->value, $date), ); } } \ No newline at end of file diff --git a/app/Filament/Components/Filters/NumberFilter.php b/app/Filament/Components/Filters/NumberFilter.php index 3ae19217d..96b705c9b 100644 --- a/app/Filament/Components/Filters/NumberFilter.php +++ b/app/Filament/Components/Filters/NumberFilter.php @@ -15,23 +15,9 @@ use Illuminate\Support\Arr; */ class NumberFilter extends Filter { - protected string $attribute = ''; protected string $fromLabel = ''; protected string $toLabel = ''; - /** - * Get the attribute used for filter. - * - * @param string $attribute - * @return static - */ - public function attribute(string $attribute): static - { - $this->attribute = $attribute; - - return $this; - } - /** * Get the label for the filters. * @@ -56,11 +42,11 @@ class NumberFilter extends Filter public function getFormSchema(): array { return [ - TextInput::make($this->attribute.'_'.'from') + TextInput::make($this->getName().'_'.'from') ->label($this->fromLabel) ->integer(), - TextInput::make($this->attribute.'_'.'to') + TextInput::make($this->getName().'_'.'to') ->label($this->toLabel) ->integer(), ]; @@ -77,12 +63,12 @@ class NumberFilter extends Filter { return $query ->when( - Arr::get($data, $this->attribute.'_'.'from'), - fn (Builder $query, $value): Builder => $query->where($this->attribute, ComparisonOperator::GTE->value, $value), + Arr::get($data, $this->getName().'_'.'from'), + fn (Builder $query, $value): Builder => $query->where($this->getName(), ComparisonOperator::GTE->value, $value), ) ->when( - Arr::get($data, $this->attribute.'_'.'to'), - fn (Builder $query, $value): Builder => $query->where($this->attribute, ComparisonOperator::LTE->value, $value), + Arr::get($data, $this->getName().'_'.'to'), + fn (Builder $query, $value): Builder => $query->where($this->getName(), ComparisonOperator::LTE->value, $value), ); } } \ No newline at end of file diff --git a/app/Filament/Components/Filters/TextFilter.php b/app/Filament/Components/Filters/TextFilter.php index dfc3b821d..dd06ae217 100644 --- a/app/Filament/Components/Filters/TextFilter.php +++ b/app/Filament/Components/Filters/TextFilter.php @@ -14,21 +14,6 @@ use Illuminate\Support\Arr; */ class TextFilter extends Filter { - protected string $attribute = ''; - - /** - * Get the attribute used for filter. - * - * @param string $attribute - * @return static - */ - public function attribute(string $attribute): static - { - $this->attribute = $attribute; - - return $this; - } - /** * Get the form for the filter. * @@ -37,7 +22,7 @@ class TextFilter extends Filter public function getFormSchema(): array { return [ - TextInput::make($this->attribute) + TextInput::make($this->getName()) ->label($this->label), ]; } @@ -51,8 +36,8 @@ class TextFilter extends Filter */ public function applyToBaseQuery(Builder $query, array $data = []): Builder { - return Arr::get($data, $this->attribute) !== null - ? $query->where($this->attribute, Arr::get($data, $this->attribute)) + return Arr::get($data, $this->getName()) !== null + ? $query->where($this->getName(), Arr::get($data, $this->getName())) : $query; } } \ No newline at end of file diff --git a/app/Filament/Components/Infolist/TextEntry.php b/app/Filament/Components/Infolist/TextEntry.php index b4ecc9d38..dc8c1eb17 100644 --- a/app/Filament/Components/Infolist/TextEntry.php +++ b/app/Filament/Components/Infolist/TextEntry.php @@ -53,6 +53,7 @@ class TextEntry extends ComponentsTextEntry { return $this ->copyable($condition) - ->copyMessage(__('filament.actions.base.copied')); + ->copyMessage(__('filament.actions.base.copied')) + ->icon('heroicon-o-clipboard'); } } \ No newline at end of file diff --git a/app/Filament/RelationManagers/Auth/PermissionRelationManager.php b/app/Filament/RelationManagers/Auth/PermissionRelationManager.php new file mode 100644 index 000000000..4fd8f7947 --- /dev/null +++ b/app/Filament/RelationManagers/Auth/PermissionRelationManager.php @@ -0,0 +1,104 @@ +heading(PermissionResource::getPluralLabel()) + ->modelLabel(PermissionResource::getLabel()) + ->recordTitleAttribute(Permission::ATTRIBUTE_NAME) + ->columns(PermissionResource::table($table)->getColumns()) + ->defaultSort(Permission::TABLE . '.' . Permission::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + PermissionResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return PermissionResource::getActions(); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + PermissionResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return PermissionResource::getHeaderActions(); + } +} diff --git a/app/Filament/RelationManagers/Auth/RoleRelationManager.php b/app/Filament/RelationManagers/Auth/RoleRelationManager.php new file mode 100644 index 000000000..6b39c8d52 --- /dev/null +++ b/app/Filament/RelationManagers/Auth/RoleRelationManager.php @@ -0,0 +1,107 @@ +heading(RoleResource::getPluralLabel()) + ->modelLabel(RoleResource::getLabel()) + ->recordTitleAttribute(Role::ATTRIBUTE_NAME) + ->columns(RoleResource::table($table)->getColumns()) + ->defaultSort(Role::TABLE . '.' . Role::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + RoleResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return [ + ViewAction::make(), + ]; + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + RoleResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return RoleResource::getHeaderActions(); + } +} diff --git a/app/Filament/RelationManagers/Auth/UserRelationManager.php b/app/Filament/RelationManagers/Auth/UserRelationManager.php new file mode 100644 index 000000000..a81c10803 --- /dev/null +++ b/app/Filament/RelationManagers/Auth/UserRelationManager.php @@ -0,0 +1,107 @@ +heading(UserResource::getPluralLabel()) + ->modelLabel(UserResource::getLabel()) + ->recordTitleAttribute(User::ATTRIBUTE_NAME) + ->columns(UserResource::table($table)->getColumns()) + ->defaultSort(User::TABLE . '.' . User::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + UserResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + UserResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + UserResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return UserResource::getHeaderActions(); + } +} diff --git a/app/Filament/Resources/BaseRelationManager.php b/app/Filament/RelationManagers/BaseRelationManager.php similarity index 71% rename from app/Filament/Resources/BaseRelationManager.php rename to app/Filament/RelationManagers/BaseRelationManager.php index bfe51628d..cd94aafba 100644 --- a/app/Filament/Resources/BaseRelationManager.php +++ b/app/Filament/RelationManagers/BaseRelationManager.php @@ -2,36 +2,24 @@ declare(strict_types=1); -namespace App\Filament\Resources; +namespace App\Filament\RelationManagers; use App\Filament\Components\Fields\Select; -use App\Filament\Resources\Wiki\Anime\RelationManagers\ResourceAnimeRelationManager; -use App\Filament\Resources\Wiki\Artist\RelationManagers\ResourceArtistRelationManager; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Filament\Resources\Wiki\Artist\RelationManagers\SongArtistRelationManager; use App\Filament\Resources\Wiki\ExternalResource\RelationManagers\AnimeResourceRelationManager; use App\Filament\Resources\Wiki\ExternalResource\RelationManagers\ArtistResourceRelationManager; use App\Filament\Resources\Wiki\ExternalResource\RelationManagers\SongResourceRelationManager; use App\Filament\Resources\Wiki\ExternalResource\RelationManagers\StudioResourceRelationManager; use App\Filament\Resources\Wiki\Song\RelationManagers\ArtistSongRelationManager; -use App\Filament\Resources\Wiki\Song\RelationManagers\ResourceSongRelationManager; -use App\Filament\Resources\Wiki\Studio\RelationManagers\ResourceStudioRelationManager; use App\Pivots\Wiki\AnimeResource; -use App\Pivots\Wiki\ArtistResource; use App\Pivots\Wiki\ArtistSong; -use App\Pivots\Wiki\StudioResource; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Resources\RelationManagers\RelationManager; use Filament\Tables\Actions\AttachAction; -use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\CreateAction; -use Filament\Tables\Actions\DeleteBulkAction; -use Filament\Tables\Actions\DetachAction; use Filament\Tables\Actions\DetachBulkAction; -use Filament\Tables\Actions\EditAction; -use Filament\Tables\Actions\ForceDeleteBulkAction; -use Filament\Tables\Actions\RestoreBulkAction; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Filters\TrashedFilter; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -41,6 +29,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; */ abstract class BaseRelationManager extends RelationManager { + protected static bool $isLazy = false; + /** * The index page of the relation resource. * @@ -84,16 +74,7 @@ abstract class BaseRelationManager extends RelationManager */ public static function getActions(): array { - return [ - ViewAction::make() - ->label(__('filament.actions.base.view')), - - EditAction::make() - ->label(__('filament.actions.base.edit')), - - DetachAction::make() - ->label(__('filament.actions.base.detach')), - ]; + return []; } /** @@ -106,19 +87,8 @@ abstract class BaseRelationManager extends RelationManager public static function getBulkActions(): array { return [ - BulkActionGroup::make([ - DeleteBulkAction::make() - ->label(__('filament.bulk_actions.base.delete')), - - ForceDeleteBulkAction::make() - ->label(__('filament.bulk_actions.base.forcedelete')), - - RestoreBulkAction::make() - ->label(__('filament.bulk_actions.base.restore')), - - DetachBulkAction::make() - ->label(__('filament.bulk_actions.base.detach')), - ]), + DetachBulkAction::make() + ->label(__('filament.bulk_actions.base.detach')), ]; } @@ -157,10 +127,7 @@ abstract class BaseRelationManager extends RelationManager ArtistResourceRelationManager::class, SongResourceRelationManager::class, StudioResourceRelationManager::class, - ResourceAnimeRelationManager::class, - ResourceArtistRelationManager::class, - ResourceSongRelationManager::class, - ResourceStudioRelationManager::class, + ResourceRelationManager::class, ]), TextInput::make(ArtistSong::ATTRIBUTE_AS) diff --git a/app/Filament/RelationManagers/List/Playlist/TrackRelationManager.php b/app/Filament/RelationManagers/List/Playlist/TrackRelationManager.php new file mode 100644 index 000000000..35bb3499c --- /dev/null +++ b/app/Filament/RelationManagers/List/Playlist/TrackRelationManager.php @@ -0,0 +1,110 @@ +heading(TrackResource::getPluralLabel()) + ->modelLabel(TrackResource::getLabel()) + ->recordTitleAttribute(PlaylistTrack::ATTRIBUTE_HASHID) + ->columns(TrackResource::table($table)->getColumns()) + ->defaultSort(PlaylistTrack::TABLE . '.' . PlaylistTrack::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + TrackResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + TrackResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + TrackResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + TrackResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/List/PlaylistRelationManager.php b/app/Filament/RelationManagers/List/PlaylistRelationManager.php new file mode 100644 index 000000000..76898af9b --- /dev/null +++ b/app/Filament/RelationManagers/List/PlaylistRelationManager.php @@ -0,0 +1,110 @@ +heading(PlaylistResource::getPluralLabel()) + ->modelLabel(PlaylistResource::getLabel()) + ->recordTitleAttribute(Playlist::ATTRIBUTE_NAME) + ->columns(PlaylistResource::table($table)->getColumns()) + ->defaultSort(Playlist::TABLE . '.' . Playlist::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + PlaylistResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + PlaylistResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + PlaylistResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + PlaylistResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/Anime/SynonymRelationManager.php b/app/Filament/RelationManagers/Wiki/Anime/SynonymRelationManager.php new file mode 100644 index 000000000..9c7c3c296 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/Anime/SynonymRelationManager.php @@ -0,0 +1,110 @@ +heading(SynonymResource::getPluralLabel()) + ->modelLabel(SynonymResource::getLabel()) + ->recordTitleAttribute(AnimeSynonym::ATTRIBUTE_TEXT) + ->columns(SynonymResource::table($table)->getColumns()) + ->defaultSort(AnimeSynonym::TABLE . '.' . AnimeSynonym::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + SynonymResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + SynonymResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + SynonymResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + SynonymResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/Anime/Theme/EntryRelationManager.php b/app/Filament/RelationManagers/Wiki/Anime/Theme/EntryRelationManager.php new file mode 100644 index 000000000..0cd323b11 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/Anime/Theme/EntryRelationManager.php @@ -0,0 +1,110 @@ +heading(EntryResource::getPluralLabel()) + ->modelLabel(EntryResource::getLabel()) + ->recordTitleAttribute(AnimeThemeEntry::ATTRIBUTE_VERSION) + ->columns(EntryResource::table($table)->getColumns()) + ->defaultSort(AnimeThemeEntry::TABLE . '.' . AnimeThemeEntry::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + EntryResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + EntryResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + EntryResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + EntryResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/Anime/ThemeRelationManager.php b/app/Filament/RelationManagers/Wiki/Anime/ThemeRelationManager.php new file mode 100644 index 000000000..264d7005e --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/Anime/ThemeRelationManager.php @@ -0,0 +1,110 @@ +heading(ThemeResource::getPluralLabel()) + ->modelLabel(ThemeResource::getLabel()) + ->recordTitle(fn ($record) => $record->getName()) + ->columns(ThemeResource::table($table)->getColumns()) + ->defaultSort(AnimeTheme::TABLE . '.' . AnimeTheme::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + ThemeResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + ThemeResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + ThemeResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + ThemeResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/AnimeRelationManager.php b/app/Filament/RelationManagers/Wiki/AnimeRelationManager.php new file mode 100644 index 000000000..411d954f3 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/AnimeRelationManager.php @@ -0,0 +1,110 @@ +heading(AnimeResource::getPluralLabel()) + ->modelLabel(AnimeResource::getLabel()) + ->recordTitleAttribute(Anime::ATTRIBUTE_NAME) + ->columns(AnimeResource::table($table)->getColumns()) + ->defaultSort(Anime::TABLE . '.' . Anime::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + AnimeResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + AnimeResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + AnimeResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + AnimeResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/ArtistRelationManager.php b/app/Filament/RelationManagers/Wiki/ArtistRelationManager.php new file mode 100644 index 000000000..f8b43e135 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/ArtistRelationManager.php @@ -0,0 +1,110 @@ +heading(ArtistResource::getPluralLabel()) + ->modelLabel(ArtistResource::getLabel()) + ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) + ->columns(ArtistResource::table($table)->getColumns()) + ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + ArtistResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + ArtistResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + ArtistResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + ArtistResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/ImageRelationManager.php b/app/Filament/RelationManagers/Wiki/ImageRelationManager.php new file mode 100644 index 000000000..3f6a14e65 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/ImageRelationManager.php @@ -0,0 +1,110 @@ +heading(ImageResource::getPluralLabel()) + ->modelLabel(ImageResource::getLabel()) + ->recordTitleAttribute(Image::ATTRIBUTE_PATH) + ->columns(ImageResource::table($table)->getColumns()) + ->defaultSort(Image::TABLE . '.' . Image::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + ImageResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + ImageResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + ImageResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + ImageResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/ResourceRelationManager.php b/app/Filament/RelationManagers/Wiki/ResourceRelationManager.php new file mode 100644 index 000000000..4dcaa9fa5 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/ResourceRelationManager.php @@ -0,0 +1,110 @@ +heading(ExternalResourceResource::getPluralLabel()) + ->modelLabel(ExternalResourceResource::getLabel()) + ->recordTitleAttribute(ExternalResource::ATTRIBUTE_LINK) + ->columns(ExternalResourceResource::table($table)->getColumns()) + ->defaultSort(ExternalResource::TABLE . '.' . ExternalResource::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + ExternalResourceResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + ExternalResourceResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + ExternalResourceResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + ExternalResourceResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/SeriesRelationManager.php b/app/Filament/RelationManagers/Wiki/SeriesRelationManager.php new file mode 100644 index 000000000..bbb53cbb0 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/SeriesRelationManager.php @@ -0,0 +1,110 @@ +heading(SeriesResource::getPluralLabel()) + ->modelLabel(SeriesResource::getLabel()) + ->recordTitleAttribute(Series::ATTRIBUTE_NAME) + ->columns(SeriesResource::table($table)->getColumns()) + ->defaultSort(Series::TABLE . '.' . Series::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + SeriesResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + SeriesResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + SeriesResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + SeriesResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/SongRelationManager.php b/app/Filament/RelationManagers/Wiki/SongRelationManager.php new file mode 100644 index 000000000..1fc905820 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/SongRelationManager.php @@ -0,0 +1,110 @@ +heading(SongResource::getPluralLabel()) + ->modelLabel(SongResource::getLabel()) + ->recordTitleAttribute(Song::ATTRIBUTE_TITLE) + ->columns(SongResource::table($table)->getColumns()) + ->defaultSort(Song::TABLE . '.' . Song::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + SongResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + SongResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + SongResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + SongResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/StudioRelationManager.php b/app/Filament/RelationManagers/Wiki/StudioRelationManager.php new file mode 100644 index 000000000..c02c8a233 --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/StudioRelationManager.php @@ -0,0 +1,110 @@ +heading(StudioResource::getPluralLabel()) + ->modelLabel(StudioResource::getLabel()) + ->recordTitleAttribute(Studio::ATTRIBUTE_NAME) + ->columns(StudioResource::table($table)->getColumns()) + ->defaultSort(Studio::TABLE . '.' . Studio::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + StudioResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + StudioResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + StudioResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + StudioResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/Video/ScriptRelationManager.php b/app/Filament/RelationManagers/Wiki/Video/ScriptRelationManager.php new file mode 100644 index 000000000..14a68210b --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/Video/ScriptRelationManager.php @@ -0,0 +1,110 @@ +heading(ScriptResource::getPluralLabel()) + ->modelLabel(ScriptResource::getLabel()) + ->recordTitleAttribute(VideoScript::ATTRIBUTE_PATH) + ->columns(ScriptResource::table($table)->getColumns()) + ->defaultSort(VideoScript::TABLE . '.' . VideoScript::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + ScriptResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + ScriptResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + ScriptResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + ScriptResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/RelationManagers/Wiki/VideoRelationManager.php b/app/Filament/RelationManagers/Wiki/VideoRelationManager.php new file mode 100644 index 000000000..b4cf5356d --- /dev/null +++ b/app/Filament/RelationManagers/Wiki/VideoRelationManager.php @@ -0,0 +1,110 @@ +heading(VideoResource::getPluralLabel()) + ->modelLabel(VideoResource::getLabel()) + ->recordTitleAttribute(Video::ATTRIBUTE_FILENAME) + ->columns(VideoResource::table($table)->getColumns()) + ->defaultSort(Video::TABLE . '.' . Video::ATTRIBUTE_ID, 'desc') + ); + } + + /** + * Get the filters available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getFilters(): array + { + return array_merge( + [], + VideoResource::getFilters(), + ); + } + + /** + * Get the actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getActions(): array + { + return array_merge( + parent::getActions(), + VideoResource::getActions(), + ); + } + + /** + * Get the bulk actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getBulkActions(): array + { + return array_merge( + parent::getBulkActions(), + VideoResource::getBulkActions(), + ); + } + + /** + * Get the header actions available for the relation. + * + * @return array + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getHeaderActions(): array + { + return array_merge( + parent::getHeaderActions(), + VideoResource::getHeaderActions(), + ); + } +} diff --git a/app/Filament/Resources/Auth/Permission.php b/app/Filament/Resources/Auth/Permission.php index 3f94515f4..da3862a11 100644 --- a/app/Filament/Resources/Auth/Permission.php +++ b/app/Filament/Resources/Auth/Permission.php @@ -141,6 +141,7 @@ class Permission extends BaseResource public static function table(Table $table): Table { return parent::table($table) + ->recordUrl(fn (PermissionModel $record): string => static::getUrl('view', ['record' => $record])) ->columns([ TextColumn::make(PermissionModel::ATTRIBUTE_ID) ->label(__('filament.fields.base.id')) diff --git a/app/Filament/Resources/Auth/Permission/RelationManagers/RolePermissionRelationManager.php b/app/Filament/Resources/Auth/Permission/RelationManagers/RolePermissionRelationManager.php index d8cb8de40..6c74ef4ed 100644 --- a/app/Filament/Resources/Auth/Permission/RelationManagers/RolePermissionRelationManager.php +++ b/app/Filament/Resources/Auth/Permission/RelationManagers/RolePermissionRelationManager.php @@ -4,18 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\Permission\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\Role as RoleResource; +use App\Filament\RelationManagers\Auth\RoleRelationManager; use App\Models\Auth\Permission; use App\Models\Auth\Role; -use Filament\Forms\Form; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; /** * Class RolePermissionRelationManager. */ -class RolePermissionRelationManager extends BaseRelationManager +class RolePermissionRelationManager extends RoleRelationManager { /** * The relationship the relation manager corresponds to. @@ -24,19 +21,6 @@ class RolePermissionRelationManager extends BaseRelationManager */ protected static string $relationship = Permission::RELATION_ROLES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return RoleResource::form($form); - } - /** * The index page of the resource. * @@ -49,12 +33,7 @@ class RolePermissionRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(RoleResource::getPluralLabel()) - ->modelLabel(RoleResource::getLabel()) - ->recordTitleAttribute(Role::ATTRIBUTE_NAME) ->inverseRelationship(Role::RELATION_PERMISSIONS) - ->columns(RoleResource::table($table)->getColumns()) - ->defaultSort(Role::TABLE . '.' . Role::ATTRIBUTE_ID, 'desc') ); } @@ -67,7 +46,10 @@ class RolePermissionRelationManager extends BaseRelationManager */ public static function getFilters(): array { - return []; + return array_merge( + [], + parent::getFilters(), + ); } /** @@ -79,14 +61,15 @@ class RolePermissionRelationManager extends BaseRelationManager */ public static function getActions(): array { - return [ - ViewAction::make(), - ]; + return array_merge( + parent::getActions(), + [], + ); } /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Auth/Permission/RelationManagers/UserPermissionRelationManager.php b/app/Filament/Resources/Auth/Permission/RelationManagers/UserPermissionRelationManager.php index d9e68220d..56b2e11be 100644 --- a/app/Filament/Resources/Auth/Permission/RelationManagers/UserPermissionRelationManager.php +++ b/app/Filament/Resources/Auth/Permission/RelationManagers/UserPermissionRelationManager.php @@ -4,18 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\Permission\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\User as UserResource; +use App\Filament\RelationManagers\Auth\UserRelationManager; use App\Models\Auth\Permission; use App\Models\Auth\User; -use Filament\Forms\Form; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; /** * Class UserPermissionRelationManager. */ -class UserPermissionRelationManager extends BaseRelationManager +class UserPermissionRelationManager extends UserRelationManager { /** * The relationship the relation manager corresponds to. @@ -24,19 +21,6 @@ class UserPermissionRelationManager extends BaseRelationManager */ protected static string $relationship = Permission::RELATION_USERS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return UserResource::form($form); - } - /** * The index page of the resource. * @@ -49,12 +33,7 @@ class UserPermissionRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(UserResource::getPluralLabel()) - ->modelLabel(UserResource::getLabel()) - ->recordTitleAttribute(User::ATTRIBUTE_NAME) ->inverseRelationship(User::RELATION_PERMISSIONS) - ->columns(UserResource::table($table)->getColumns()) - ->defaultSort(User::TABLE . '.' . User::ATTRIBUTE_ID, 'desc') ); } @@ -67,7 +46,10 @@ class UserPermissionRelationManager extends BaseRelationManager */ public static function getFilters(): array { - return []; + return array_merge( + [], + parent::getFilters(), + ); } /** @@ -79,9 +61,10 @@ class UserPermissionRelationManager extends BaseRelationManager */ public static function getActions(): array { - return [ - ViewAction::make(), - ]; + return array_merge( + parent::getActions(), + [], + ); } /** diff --git a/app/Filament/Resources/Auth/Role.php b/app/Filament/Resources/Auth/Role.php index 9f386c75a..880c3b464 100644 --- a/app/Filament/Resources/Auth/Role.php +++ b/app/Filament/Resources/Auth/Role.php @@ -268,8 +268,7 @@ class Role extends BaseResource ->checkbox(), NumberFilter::make(RoleModel::ATTRIBUTE_PRIORITY) - ->labels(__('filament.filters.role.priority_from'), __('filament.filters.role.priority_to')) - ->attribute(RoleModel::ATTRIBUTE_PRIORITY), + ->labels(__('filament.filters.role.priority_from'), __('filament.filters.role.priority_to')), ]; } diff --git a/app/Filament/Resources/Auth/Role/RelationManagers/PermissionRoleRelationManager.php b/app/Filament/Resources/Auth/Role/RelationManagers/PermissionRoleRelationManager.php index 8d1fe767b..3e9efbde9 100644 --- a/app/Filament/Resources/Auth/Role/RelationManagers/PermissionRoleRelationManager.php +++ b/app/Filament/Resources/Auth/Role/RelationManagers/PermissionRoleRelationManager.php @@ -4,19 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\Role\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\Permission as PermissionResource; +use App\Filament\RelationManagers\Auth\PermissionRelationManager; use App\Models\Auth\Role; use App\Models\Auth\Permission; -use Filament\Forms\Form; -use Filament\Tables\Actions\EditAction; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; /** * Class PermissionRoleRelationManager. */ -class PermissionRoleRelationManager extends BaseRelationManager +class PermissionRoleRelationManager extends PermissionRelationManager { /** * The relationship the relation manager corresponds to. @@ -25,19 +21,6 @@ class PermissionRoleRelationManager extends BaseRelationManager */ protected static string $relationship = Role::RELATION_PERMISSIONS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return PermissionResource::form($form); - } - /** * The index page of the resource. * @@ -50,12 +33,7 @@ class PermissionRoleRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(PermissionResource::getPluralLabel()) - ->modelLabel(PermissionResource::getLabel()) - ->recordTitleAttribute(Permission::ATTRIBUTE_NAME) ->inverseRelationship(Permission::RELATION_ROLES) - ->columns(PermissionResource::table($table)->getColumns()) - ->defaultSort(Permission::TABLE . '.' . Permission::ATTRIBUTE_ID, 'desc') ); } @@ -68,7 +46,10 @@ class PermissionRoleRelationManager extends BaseRelationManager */ public static function getFilters(): array { - return []; + return array_merge( + [], + parent::getFilters(), + ); } /** @@ -80,15 +61,15 @@ class PermissionRoleRelationManager extends BaseRelationManager */ public static function getActions(): array { - return [ - ViewAction::make(), - EditAction::make(), - ]; + return array_merge( + parent::getActions(), + [], + ); } /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Auth/Role/RelationManagers/UserRoleRelationManager.php b/app/Filament/Resources/Auth/Role/RelationManagers/UserRoleRelationManager.php index 7bf4e1f75..e0c1b6427 100644 --- a/app/Filament/Resources/Auth/Role/RelationManagers/UserRoleRelationManager.php +++ b/app/Filament/Resources/Auth/Role/RelationManagers/UserRoleRelationManager.php @@ -4,11 +4,9 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\Role\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\User as UserResource; +use App\Filament\RelationManagers\Auth\UserRelationManager; use App\Models\Auth\Role; use App\Models\Auth\User; -use Filament\Forms\Form; use Filament\Tables\Actions\EditAction; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; @@ -16,7 +14,7 @@ use Filament\Tables\Table; /** * Class UserRoleRelationManager. */ -class UserRoleRelationManager extends BaseRelationManager +class UserRoleRelationManager extends UserRelationManager { /** * The relationship the relation manager corresponds to. @@ -25,19 +23,6 @@ class UserRoleRelationManager extends BaseRelationManager */ protected static string $relationship = Role::RELATION_USERS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return UserResource::form($form); - } - /** * The index page of the resource. * @@ -50,12 +35,7 @@ class UserRoleRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(UserResource::getPluralLabel()) - ->modelLabel(UserResource::getLabel()) - ->recordTitleAttribute(User::ATTRIBUTE_NAME) ->inverseRelationship(User::RELATION_ROLES) - ->columns(UserResource::table($table)->getColumns()) - ->defaultSort(User::TABLE . '.' . User::ATTRIBUTE_ID, 'desc') ); } diff --git a/app/Filament/Resources/Auth/User/RelationManagers/PermissionUserRelationManager.php b/app/Filament/Resources/Auth/User/RelationManagers/PermissionUserRelationManager.php index 597d09270..49e65dd4b 100644 --- a/app/Filament/Resources/Auth/User/RelationManagers/PermissionUserRelationManager.php +++ b/app/Filament/Resources/Auth/User/RelationManagers/PermissionUserRelationManager.php @@ -4,19 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\User\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\Permission as PermissionResource; +use App\Filament\RelationManagers\Auth\PermissionRelationManager; use App\Models\Auth\User; use App\Models\Auth\Permission; -use Filament\Forms\Form; -use Filament\Tables\Actions\EditAction; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; /** * Class PermissionUserRelationManager. */ -class PermissionUserRelationManager extends BaseRelationManager +class PermissionUserRelationManager extends PermissionRelationManager { /** * The relationship the relation manager corresponds to. @@ -25,19 +21,6 @@ class PermissionUserRelationManager extends BaseRelationManager */ protected static string $relationship = User::RELATION_PERMISSIONS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return PermissionResource::form($form); - } - /** * The index page of the resource. * @@ -50,12 +33,7 @@ class PermissionUserRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(PermissionResource::getPluralLabel()) - ->modelLabel(PermissionResource::getLabel()) - ->recordTitleAttribute(Permission::ATTRIBUTE_NAME) ->inverseRelationship(Permission::RELATION_USERS) - ->columns(PermissionResource::table($table)->getColumns()) - ->defaultSort(Permission::TABLE . '.' . Permission::ATTRIBUTE_ID, 'desc') ); } @@ -68,7 +46,10 @@ class PermissionUserRelationManager extends BaseRelationManager */ public static function getFilters(): array { - return []; + return array_merge( + [], + parent::getFilters(), + ); } /** @@ -80,15 +61,15 @@ class PermissionUserRelationManager extends BaseRelationManager */ public static function getActions(): array { - return [ - ViewAction::make(), - EditAction::make(), - ]; + return array_merge( + parent::getActions(), + [], + ); } /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Auth/User/RelationManagers/PlaylistUserRelationManager.php b/app/Filament/Resources/Auth/User/RelationManagers/PlaylistUserRelationManager.php index 78890cc93..8f00412da 100644 --- a/app/Filament/Resources/Auth/User/RelationManagers/PlaylistUserRelationManager.php +++ b/app/Filament/Resources/Auth/User/RelationManagers/PlaylistUserRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\User\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\List\Playlist as PlaylistResource; +use App\Filament\RelationManagers\List\PlaylistRelationManager; use App\Models\Auth\User; use App\Models\List\Playlist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class PlaylistUserRelationManager. */ -class PlaylistUserRelationManager extends BaseRelationManager +class PlaylistUserRelationManager extends PlaylistRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class PlaylistUserRelationManager extends BaseRelationManager */ protected static string $relationship = User::RELATION_PLAYLISTS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return PlaylistResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class PlaylistUserRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(PlaylistResource::getPluralLabel()) - ->modelLabel(PlaylistResource::getLabel()) - ->recordTitleAttribute(Playlist::ATTRIBUTE_NAME) ->inverseRelationship(Playlist::RELATION_USER) - ->columns(PlaylistResource::table($table)->getColumns()) - ->defaultSort(Playlist::TABLE . '.' . Playlist::ATTRIBUTE_ID, 'desc') ); } diff --git a/app/Filament/Resources/Auth/User/RelationManagers/RoleUserRelationManager.php b/app/Filament/Resources/Auth/User/RelationManagers/RoleUserRelationManager.php index 17bdd4078..bb84acd24 100644 --- a/app/Filament/Resources/Auth/User/RelationManagers/RoleUserRelationManager.php +++ b/app/Filament/Resources/Auth/User/RelationManagers/RoleUserRelationManager.php @@ -4,19 +4,16 @@ declare(strict_types=1); namespace App\Filament\Resources\Auth\User\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Auth\Role as RoleResource; +use App\Filament\RelationManagers\Auth\RoleRelationManager; use App\Models\Auth\User; use App\Models\Auth\Role; -use Filament\Forms\Form; use Filament\Tables\Actions\EditAction; -use Filament\Tables\Actions\ViewAction; use Filament\Tables\Table; /** * Class RoleUserRelationManager. */ -class RoleUserRelationManager extends BaseRelationManager +class RoleUserRelationManager extends RoleRelationManager { /** * The relationship the relation manager corresponds to. @@ -25,19 +22,6 @@ class RoleUserRelationManager extends BaseRelationManager */ protected static string $relationship = User::RELATION_ROLES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return RoleResource::form($form); - } - /** * The index page of the resource. * @@ -50,12 +34,7 @@ class RoleUserRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(RoleResource::getPluralLabel()) - ->modelLabel(RoleResource::getLabel()) - ->recordTitleAttribute(Role::ATTRIBUTE_NAME) ->inverseRelationship(Role::RELATION_USERS) - ->columns(RoleResource::table($table)->getColumns()) - ->defaultSort(Role::TABLE . '.' . Role::ATTRIBUTE_ID, 'desc') ); } @@ -68,7 +47,10 @@ class RoleUserRelationManager extends BaseRelationManager */ public static function getFilters(): array { - return []; + return array_merge( + [], + parent::getFilters(), + ); } /** @@ -80,15 +62,17 @@ class RoleUserRelationManager extends BaseRelationManager */ public static function getActions(): array { - return [ - ViewAction::make(), - EditAction::make(), - ]; + return array_merge( + parent::getActions(), + [ + EditAction::make(), + ], + ); } /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/BaseResource.php b/app/Filament/Resources/BaseResource.php index ffcf6418a..f25439ccd 100644 --- a/app/Filament/Resources/BaseResource.php +++ b/app/Filament/Resources/BaseResource.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Filament\Resources; use App\Filament\Components\Filters\DateFilter; +use App\Filament\RelationManagers\BaseRelationManager; use App\Models\BaseModel; use Filament\Infolists\Components\TextEntry; use Filament\Resources\Resource; @@ -12,6 +13,7 @@ use Filament\Tables\Actions\ActionGroup; use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteAction; use Filament\Tables\Actions\DeleteBulkAction; +use Filament\Tables\Actions\DetachAction; use Filament\Tables\Actions\EditAction; use Filament\Tables\Actions\ForceDeleteAction; use Filament\Tables\Actions\ForceDeleteBulkAction; @@ -99,15 +101,12 @@ abstract class BaseResource extends Resource TrashedFilter::make(), DateFilter::make(BaseModel::ATTRIBUTE_CREATED_AT) - ->attribute(BaseModel::ATTRIBUTE_CREATED_AT) ->labels(__('filament.filters.base.created_at_from'), __('filament.filters.base.created_at_to')), DateFilter::make(BaseModel::ATTRIBUTE_UPDATED_AT) - ->attribute(BaseModel::ATTRIBUTE_UPDATED_AT) ->labels(__('filament.filters.base.updated_at_from'), __('filament.filters.base.updated_at_to')), DateFilter::make(BaseModel::ATTRIBUTE_DELETED_AT) - ->attribute(BaseModel::ATTRIBUTE_DELETED_AT) ->labels(__('filament.filters.base.deleted_at_from'), __('filament.filters.base.deleted_at_to')), ]; } @@ -129,6 +128,10 @@ abstract class BaseResource extends Resource ->label(__('filament.actions.base.edit')), ActionGroup::make([ + DetachAction::make() + ->label(__('filament.actions.base.detach')) + ->hidden(fn ($livewire) => !($livewire instanceof BaseRelationManager)), + DeleteAction::make() ->label(__('filament.actions.base.delete')), diff --git a/app/Filament/Resources/List/Playlist/RelationManagers/ImagePlaylistRelationManager.php b/app/Filament/Resources/List/Playlist/RelationManagers/ImagePlaylistRelationManager.php index 798e46909..dfe41de49 100644 --- a/app/Filament/Resources/List/Playlist/RelationManagers/ImagePlaylistRelationManager.php +++ b/app/Filament/Resources/List/Playlist/RelationManagers/ImagePlaylistRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\List\Playlist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Image as ImageResource; +use App\Filament\RelationManagers\Wiki\ImageRelationManager; use App\Models\List\Playlist; use App\Models\Wiki\Image; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ImagePlaylistRelationManager. */ -class ImagePlaylistRelationManager extends BaseRelationManager +class ImagePlaylistRelationManager extends ImageRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ImagePlaylistRelationManager extends BaseRelationManager */ protected static string $relationship = Playlist::RELATION_IMAGES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ImageResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ImagePlaylistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ImageResource::getPluralLabel()) - ->modelLabel(ImageResource::getLabel()) - ->recordTitleAttribute(Image::ATTRIBUTE_PATH) - ->inverseRelationship(Image::RELATION_PLAYLISTS) - ->columns(ImageResource::table($table)->getColumns()) - ->defaultSort(Image::TABLE.'.'.Image::ATTRIBUTE_ID, 'desc') + ->inverseRelationship(Image::RELATION_PLAYLISTS) ); } @@ -67,8 +47,8 @@ class ImagePlaylistRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ImagePlaylistRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/List/Playlist/RelationManagers/TrackPlaylistRelationManager.php b/app/Filament/Resources/List/Playlist/RelationManagers/TrackPlaylistRelationManager.php index e82efb678..1f4aeabcf 100644 --- a/app/Filament/Resources/List/Playlist/RelationManagers/TrackPlaylistRelationManager.php +++ b/app/Filament/Resources/List/Playlist/RelationManagers/TrackPlaylistRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\List\Playlist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\List\Playlist\Track as TrackResource; +use App\Filament\RelationManagers\List\Playlist\TrackRelationManager; use App\Models\List\Playlist; use App\Models\List\Playlist\PlaylistTrack; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class TrackPlaylistRelationManager. */ -class TrackPlaylistRelationManager extends BaseRelationManager +class TrackPlaylistRelationManager extends TrackRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class TrackPlaylistRelationManager extends BaseRelationManager */ protected static string $relationship = Playlist::RELATION_TRACKS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return TrackResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class TrackPlaylistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(TrackResource::getPluralLabel()) - ->modelLabel(TrackResource::getLabel()) - ->recordTitleAttribute(PlaylistTrack::ATTRIBUTE_HASHID) ->inverseRelationship(PlaylistTrack::RELATION_PLAYLIST) - ->columns(TrackResource::table($table)->getColumns()) - ->defaultSort(PlaylistTrack::TABLE . '.' . PlaylistTrack::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class TrackPlaylistRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class TrackPlaylistRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime.php b/app/Filament/Resources/Wiki/Anime.php index 0b62b4391..7a784e675 100644 --- a/app/Filament/Resources/Wiki/Anime.php +++ b/app/Filament/Resources/Wiki/Anime.php @@ -380,8 +380,7 @@ class Anime extends BaseResource return array_merge( [ NumberFilter::make(AnimeModel::ATTRIBUTE_YEAR) - ->labels(__('filament.filters.anime.year_from'), __('filament.filters.anime.year_to')) - ->attribute(AnimeModel::ATTRIBUTE_YEAR), + ->labels(__('filament.filters.anime.year_from'), __('filament.filters.anime.year_to')), SelectFilter::make(AnimeModel::ATTRIBUTE_SEASON) ->label(__('filament.fields.anime.season.name')) diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/ImageAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/ImageAnimeRelationManager.php index a0447868d..f55825ad3 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/ImageAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/ImageAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Image as ImageResource; +use App\Filament\RelationManagers\Wiki\ImageRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\Image; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ImageAnimeRelationManager. */ -class ImageAnimeRelationManager extends BaseRelationManager +class ImageAnimeRelationManager extends ImageRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ImageAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_IMAGES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ImageResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ImageAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ImageResource::getPluralLabel()) - ->modelLabel(ImageResource::getLabel()) - ->recordTitleAttribute(Image::ATTRIBUTE_PATH) ->inverseRelationship(Image::RELATION_ANIME) - ->columns(ImageResource::table($table)->getColumns()) - ->defaultSort(Image::TABLE . '.' . Image::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ImageAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ImageAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/ResourceAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/ResourceAnimeRelationManager.php index 3a6b1a493..12491f783 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/ResourceAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/ResourceAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\ExternalResource as ExternalResourceResource; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ResourceAnimeRelationManager. */ -class ResourceAnimeRelationManager extends BaseRelationManager +class ResourceAnimeRelationManager extends ResourceRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ResourceAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_RESOURCES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ExternalResourceResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ResourceAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ExternalResourceResource::getPluralLabel()) - ->modelLabel(ExternalResourceResource::getLabel()) - ->recordTitleAttribute(ExternalResource::ATTRIBUTE_LINK) ->inverseRelationship(ExternalResource::RELATION_ANIME) - ->columns(ExternalResourceResource::table($table)->getColumns()) - ->defaultSort(ExternalResource::TABLE . '.' . ExternalResource::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ResourceAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ResourceAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/SeriesAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/SeriesAnimeRelationManager.php index 4d7cf6dad..8e2d80061 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/SeriesAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/SeriesAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Series as SeriesResource; +use App\Filament\RelationManagers\Wiki\SeriesRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\Series; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class SeriesAnimeRelationManager. */ -class SeriesAnimeRelationManager extends BaseRelationManager +class SeriesAnimeRelationManager extends SeriesRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class SeriesAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_SERIES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return SeriesResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class SeriesAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(SeriesResource::getPluralLabel()) - ->modelLabel(SeriesResource::getLabel()) - ->recordTitleAttribute(Series::ATTRIBUTE_NAME) ->inverseRelationship(Series::RELATION_ANIME) - ->columns(SeriesResource::table($table)->getColumns()) - ->defaultSort(Series::TABLE . '.' . Series::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class SeriesAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class SeriesAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/StudioAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/StudioAnimeRelationManager.php index 8fc82afe3..effdf345a 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/StudioAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/StudioAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Studio as StudioResource; +use App\Filament\RelationManagers\Wiki\StudioRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\Studio; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class StudioAnimeRelationManager. */ -class StudioAnimeRelationManager extends BaseRelationManager +class StudioAnimeRelationManager extends StudioRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class StudioAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_STUDIOS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return StudioResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class StudioAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(StudioResource::getPluralLabel()) - ->modelLabel(StudioResource::getLabel()) - ->recordTitleAttribute(Studio::ATTRIBUTE_NAME) ->inverseRelationship(Studio::RELATION_ANIME) - ->columns(StudioResource::table($table)->getColumns()) - ->defaultSort(Studio::TABLE . '.' . Studio::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class StudioAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class StudioAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/SynonymAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/SynonymAnimeRelationManager.php index 8cbdf2d24..0dcda1817 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/SynonymAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/SynonymAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Synonym as Synonym; +use App\Filament\RelationManagers\Wiki\Anime\SynonymRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\Anime\AnimeSynonym as SynonymModel; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class SynonymAnimeRelationManager. */ -class SynonymAnimeRelationManager extends BaseRelationManager +class SynonymAnimeRelationManager extends SynonymRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class SynonymAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_SYNONYMS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return Synonym::form($form); - } - /** * The index page of the Synonym. * @@ -48,12 +33,7 @@ class SynonymAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(Synonym::getPluralLabel()) - ->modelLabel(Synonym::getLabel()) - ->recordTitleAttribute(SynonymModel::ATTRIBUTE_TEXT) ->inverseRelationship(SynonymModel::RELATION_ANIME) - ->columns(Synonym::table($table)->getColumns()) - ->defaultSort(SynonymModel::TABLE . '.' . SynonymModel::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class SynonymAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class SynonymAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/RelationManagers/ThemeAnimeRelationManager.php b/app/Filament/Resources/Wiki/Anime/RelationManagers/ThemeAnimeRelationManager.php index 87ce0a966..ba7acde0f 100644 --- a/app/Filament/Resources/Wiki/Anime/RelationManagers/ThemeAnimeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/RelationManagers/ThemeAnimeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Theme as Theme; +use App\Filament\RelationManagers\Wiki\Anime\ThemeRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\Anime\AnimeTheme as ThemeModel; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ThemeAnimeRelationManager. */ -class ThemeAnimeRelationManager extends BaseRelationManager +class ThemeAnimeRelationManager extends ThemeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ThemeAnimeRelationManager extends BaseRelationManager */ protected static string $relationship = Anime::RELATION_THEMES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return Theme::form($form); - } - /** * The index page of the Theme. * @@ -48,12 +33,7 @@ class ThemeAnimeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(Theme::getPluralLabel()) - ->modelLabel(Theme::getLabel()) - ->recordTitleAttribute(ThemeModel::ATTRIBUTE_SLUG) ->inverseRelationship(ThemeModel::RELATION_ANIME) - ->columns(Theme::table($table)->getColumns()) - ->defaultSort(ThemeModel::TABLE.'.'.ThemeModel::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ThemeAnimeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ThemeAnimeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/Synonym.php b/app/Filament/Resources/Wiki/Anime/Synonym.php index 89de8a6da..f6939b5f7 100644 --- a/app/Filament/Resources/Wiki/Anime/Synonym.php +++ b/app/Filament/Resources/Wiki/Anime/Synonym.php @@ -8,7 +8,7 @@ use App\Enums\Models\Wiki\AnimeSynonymType; use App\Filament\Components\Columns\TextColumn; use App\Filament\Components\Fields\Select; use App\Filament\Components\Infolist\TextEntry; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\Wiki\Anime\SynonymRelationManager; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\Anime as AnimeResource; use App\Filament\Resources\Wiki\Anime\RelationManagers\SynonymAnimeRelationManager; @@ -126,7 +126,7 @@ class Synonym extends BaseResource ->label(__('filament.resources.singularLabel.anime')) ->relationship(SynonymModel::RELATION_ANIME, AnimeModel::ATTRIBUTE_NAME) ->searchable() - ->hiddenOn(BaseRelationManager::class), + ->hiddenOn(SynonymRelationManager::class), Select::make(SynonymModel::ATTRIBUTE_TYPE) ->label(__('filament.fields.anime_synonym.type.name')) diff --git a/app/Filament/Resources/Wiki/Anime/Theme.php b/app/Filament/Resources/Wiki/Anime/Theme.php index 07fc4c5ba..6d0b27328 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme.php +++ b/app/Filament/Resources/Wiki/Anime/Theme.php @@ -9,7 +9,7 @@ use App\Filament\Components\Columns\TextColumn; use App\Filament\Components\Fields\Select; use App\Filament\Components\Filters\NumberFilter; use App\Filament\Components\Infolist\TextEntry; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\Wiki\Anime\ThemeRelationManager; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\Anime as AnimeResource; use App\Filament\Resources\Wiki\Anime\RelationManagers\ThemeAnimeRelationManager; @@ -162,7 +162,7 @@ class Theme extends BaseResource ->label(__('filament.resources.singularLabel.anime')) ->relationship(ThemeModel::RELATION_ANIME, AnimeModel::ATTRIBUTE_NAME) ->searchable() - ->hiddenOn(BaseRelationManager::class), + ->hiddenOn(ThemeRelationManager::class), Select::make(ThemeModel::ATTRIBUTE_TYPE) ->label(__('filament.fields.anime_theme.type.name')) @@ -376,8 +376,7 @@ class Theme extends BaseResource ->options(ThemeType::asSelectArray()), NumberFilter::make(ThemeModel::ATTRIBUTE_SEQUENCE) - ->labels(__('filament.filters.anime_theme.sequence_from'), __('filament.filters.anime_theme.sequence_to')) - ->attribute(ThemeModel::ATTRIBUTE_SEQUENCE), + ->labels(__('filament.filters.anime_theme.sequence_from'), __('filament.filters.anime_theme.sequence_to')), ], parent::getFilters(), ); diff --git a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php index dad56a48f..90e944f33 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php +++ b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php @@ -9,7 +9,7 @@ use App\Filament\Components\Fields\Select; use App\Filament\Components\Filters\NumberFilter; use App\Filament\Components\Filters\TextFilter; use App\Filament\Components\Infolist\TextEntry; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\Wiki\Anime\Theme\EntryRelationManager; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\Anime as AnimeResource; use App\Filament\Resources\Wiki\Anime\Theme as ThemeResource; @@ -162,9 +162,9 @@ class Entry extends BaseResource ->label(__('filament.resources.singularLabel.anime')) ->relationship(EntryModel::RELATION_ANIME_SHALLOW, AnimeModel::ATTRIBUTE_NAME) ->searchable() - ->hiddenOn(BaseRelationManager::class) + ->hiddenOn(EntryRelationManager::class) ->formatStateUsing(function ($livewire, $state) { - if ($livewire instanceof BaseRelationManager) { + if ($livewire instanceof EntryRelationManager) { /** @var EntryModel */ $entry = $livewire->getOwnerRecord(); return $entry->anime->getName(); @@ -177,7 +177,7 @@ class Entry extends BaseResource ->label(__('filament.resources.singularLabel.anime_theme')) ->relationship(EntryModel::RELATION_THEME, ThemeModel::ATTRIBUTE_ID) ->searchable() - ->hiddenOn(BaseRelationManager::class) + ->hiddenOn(EntryRelationManager::class) ->allowHtml() ->getSearchResultsUsing(function ($search) { return ThemeModel::search($search) @@ -360,12 +360,10 @@ class Entry extends BaseResource return array_merge( [ NumberFilter::make(EntryModel::ATTRIBUTE_VERSION) - ->labels(__('filament.filters.anime_theme_entry.version_from'), __('filament.filters.anime_theme_entry.version_to')) - ->attribute(EntryModel::ATTRIBUTE_VERSION), + ->labels(__('filament.filters.anime_theme_entry.version_from'), __('filament.filters.anime_theme_entry.version_to')), TextFilter::make(EntryModel::ATTRIBUTE_EPISODES) - ->label(__('filament.fields.anime_theme_entry.episodes.name')) - ->attribute(EntryModel::ATTRIBUTE_EPISODES), + ->label(__('filament.fields.anime_theme_entry.episodes.name')), Filter::make(EntryModel::ATTRIBUTE_NSFW) ->label(__('filament.fields.anime_theme_entry.nsfw.name')) diff --git a/app/Filament/Resources/Wiki/Anime/Theme/Entry/RelationManagers/VideoEntryRelationManager.php b/app/Filament/Resources/Wiki/Anime/Theme/Entry/RelationManagers/VideoEntryRelationManager.php index 6b42623a3..7c8a9343f 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme/Entry/RelationManagers/VideoEntryRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/Theme/Entry/RelationManagers/VideoEntryRelationManager.php @@ -4,17 +4,16 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\Theme\Entry\RelationManagers; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\Wiki\VideoRelationManager; use App\Filament\Resources\Wiki\Video as VideoResource; use App\Models\Wiki\Anime\Theme\AnimeThemeEntry; use App\Models\Wiki\Video; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class VideoEntryRelationManager. */ -class VideoEntryRelationManager extends BaseRelationManager +class VideoEntryRelationManager extends VideoRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +22,6 @@ class VideoEntryRelationManager extends BaseRelationManager */ protected static string $relationship = AnimeThemeEntry::RELATION_VIDEOS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return VideoResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +34,7 @@ class VideoEntryRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(VideoResource::getPluralLabel()) - ->modelLabel(VideoResource::getLabel()) - ->recordTitleAttribute(Video::ATTRIBUTE_FILENAME) ->inverseRelationship(Video::RELATION_ANIMETHEMEENTRIES) - ->columns(VideoResource::table($table)->getColumns()) - ->defaultSort(Video::TABLE . '.' . Video::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +48,8 @@ class VideoEntryRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +70,7 @@ class VideoEntryRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Anime/Theme/RelationManagers/EntryThemeRelationManager.php b/app/Filament/Resources/Wiki/Anime/Theme/RelationManagers/EntryThemeRelationManager.php index 6bc505403..dae61ab25 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme/RelationManagers/EntryThemeRelationManager.php +++ b/app/Filament/Resources/Wiki/Anime/Theme/RelationManagers/EntryThemeRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Anime\Theme\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Theme\Entry as EntryResource; +use App\Filament\RelationManagers\Wiki\Anime\Theme\EntryRelationManager; use App\Models\Wiki\Anime\Theme\AnimeThemeEntry; use App\Models\Wiki\Anime\AnimeTheme; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class EntryThemeRelationManager. */ -class EntryThemeRelationManager extends BaseRelationManager +class EntryThemeRelationManager extends EntryRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class EntryThemeRelationManager extends BaseRelationManager */ protected static string $relationship = AnimeTheme::RELATION_ENTRIES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return EntryResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class EntryThemeRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(EntryResource::getPluralLabel()) - ->modelLabel(EntryResource::getLabel()) - ->recordTitleAttribute(AnimeThemeEntry::ATTRIBUTE_VERSION) ->inverseRelationship(AnimeThemeEntry::RELATION_THEME) - ->columns(EntryResource::table($table)->getColumns()) - ->defaultSort(AnimeThemeEntry::TABLE . '.' . AnimeThemeEntry::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class EntryThemeRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class EntryThemeRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Artist/RelationManagers/GroupArtistRelationManager.php b/app/Filament/Resources/Wiki/Artist/RelationManagers/GroupArtistRelationManager.php index 8d4eee0f7..5a5e87258 100644 --- a/app/Filament/Resources/Wiki/Artist/RelationManagers/GroupArtistRelationManager.php +++ b/app/Filament/Resources/Wiki/Artist/RelationManagers/GroupArtistRelationManager.php @@ -4,16 +4,14 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Artist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Artist as ArtistResource; +use App\Filament\RelationManagers\Wiki\ArtistRelationManager; use App\Models\Wiki\Artist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class GroupArtistRelationManager. */ -class GroupArtistRelationManager extends BaseRelationManager +class GroupArtistRelationManager extends ArtistRelationManager { /** * The relationship the relation manager corresponds to. @@ -22,19 +20,6 @@ class GroupArtistRelationManager extends BaseRelationManager */ protected static string $relationship = Artist::RELATION_GROUPS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ArtistResource::form($form); - } - /** * The index page of the resource. * @@ -47,13 +32,10 @@ class GroupArtistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(__('filament.resources.label.groups')) - ->modelLabel(__('filament.resources.singularLabel.group')) - ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) ->inverseRelationship(Artist::RELATION_MEMBERS) - ->columns(ArtistResource::table($table)->getColumns()) - ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') - ); + ) + ->heading(__('filament.resources.label.groups')) + ->modelLabel(__('filament.resources.singularLabel.group')); } /** diff --git a/app/Filament/Resources/Wiki/Artist/RelationManagers/ImageArtistRelationManager.php b/app/Filament/Resources/Wiki/Artist/RelationManagers/ImageArtistRelationManager.php index 2a0a35e74..b1fa00509 100644 --- a/app/Filament/Resources/Wiki/Artist/RelationManagers/ImageArtistRelationManager.php +++ b/app/Filament/Resources/Wiki/Artist/RelationManagers/ImageArtistRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Artist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Image as ImageResource; +use App\Filament\RelationManagers\Wiki\ImageRelationManager; use App\Models\Wiki\Artist; use App\Models\Wiki\Image; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ImageArtistRelationManager. */ -class ImageArtistRelationManager extends BaseRelationManager +class ImageArtistRelationManager extends ImageRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ImageArtistRelationManager extends BaseRelationManager */ protected static string $relationship = Artist::RELATION_IMAGES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ImageResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ImageArtistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ImageResource::getPluralLabel()) - ->modelLabel(ImageResource::getLabel()) - ->recordTitleAttribute(Image::ATTRIBUTE_PATH) ->inverseRelationship(Image::RELATION_ARTISTS) - ->columns(ImageResource::table($table)->getColumns()) - ->defaultSort(Image::TABLE . '.' . Image::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ImageArtistRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ImageArtistRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Artist/RelationManagers/MemberArtistRelationManager.php b/app/Filament/Resources/Wiki/Artist/RelationManagers/MemberArtistRelationManager.php index 8aefe87fc..38e036499 100644 --- a/app/Filament/Resources/Wiki/Artist/RelationManagers/MemberArtistRelationManager.php +++ b/app/Filament/Resources/Wiki/Artist/RelationManagers/MemberArtistRelationManager.php @@ -4,16 +4,14 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Artist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Artist as ArtistResource; +use App\Filament\RelationManagers\Wiki\ArtistRelationManager; use App\Models\Wiki\Artist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class MemberArtistRelationManager. */ -class MemberArtistRelationManager extends BaseRelationManager +class MemberArtistRelationManager extends ArtistRelationManager { /** * The relationship the relation manager corresponds to. @@ -22,19 +20,6 @@ class MemberArtistRelationManager extends BaseRelationManager */ protected static string $relationship = Artist::RELATION_MEMBERS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ArtistResource::form($form); - } - /** * The index page of the resource. * @@ -47,13 +32,10 @@ class MemberArtistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(__('filament.resources.label.members')) - ->modelLabel(__('filament.resources.singularLabel.member')) - ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) ->inverseRelationship(Artist::RELATION_GROUPS) - ->columns(ArtistResource::table($table)->getColumns()) - ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') - ); + ) + ->heading(__('filament.resources.label.members')) + ->modelLabel(__('filament.resources.singularLabel.member')); } /** diff --git a/app/Filament/Resources/Wiki/Artist/RelationManagers/ResourceArtistRelationManager.php b/app/Filament/Resources/Wiki/Artist/RelationManagers/ResourceArtistRelationManager.php index 93c214a78..af44f9c54 100644 --- a/app/Filament/Resources/Wiki/Artist/RelationManagers/ResourceArtistRelationManager.php +++ b/app/Filament/Resources/Wiki/Artist/RelationManagers/ResourceArtistRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Artist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\ExternalResource as ExternalResourceResource; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Models\Wiki\Artist; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ResourceArtistRelationManager. */ -class ResourceArtistRelationManager extends BaseRelationManager +class ResourceArtistRelationManager extends ResourceRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ResourceArtistRelationManager extends BaseRelationManager */ protected static string $relationship = Artist::RELATION_RESOURCES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ExternalResourceResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ResourceArtistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ExternalResourceResource::getPluralLabel()) - ->modelLabel(ExternalResourceResource::getLabel()) - ->recordTitleAttribute(ExternalResource::ATTRIBUTE_LINK) ->inverseRelationship(ExternalResource::RELATION_ARTISTS) - ->columns(ExternalResourceResource::table($table)->getColumns()) - ->defaultSort(ExternalResource::TABLE . '.' . ExternalResource::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ResourceArtistRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ResourceArtistRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Artist/RelationManagers/SongArtistRelationManager.php b/app/Filament/Resources/Wiki/Artist/RelationManagers/SongArtistRelationManager.php index dc8cdf602..757805067 100644 --- a/app/Filament/Resources/Wiki/Artist/RelationManagers/SongArtistRelationManager.php +++ b/app/Filament/Resources/Wiki/Artist/RelationManagers/SongArtistRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Artist\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Song as SongResource; +use App\Filament\RelationManagers\Wiki\SongRelationManager; use App\Models\Wiki\Artist; use App\Models\Wiki\Song; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class SongArtistRelationManager. */ -class SongArtistRelationManager extends BaseRelationManager +class SongArtistRelationManager extends SongRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class SongArtistRelationManager extends BaseRelationManager */ protected static string $relationship = Artist::RELATION_SONGS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return SongResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class SongArtistRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(SongResource::getPluralLabel()) - ->modelLabel(SongResource::getLabel()) - ->recordTitleAttribute(Song::ATTRIBUTE_TITLE) ->inverseRelationship(Song::RELATION_ARTISTS) - ->columns(SongResource::table($table)->getColumns()) - ->defaultSort(Song::TABLE . '.' . Song::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class SongArtistRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class SongArtistRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Audio.php b/app/Filament/Resources/Wiki/Audio.php index 099b73155..8382d4d18 100644 --- a/app/Filament/Resources/Wiki/Audio.php +++ b/app/Filament/Resources/Wiki/Audio.php @@ -9,7 +9,6 @@ use App\Filament\Actions\Storage\Wiki\Audio\DeleteAudioAction; use App\Filament\Actions\Storage\Wiki\Audio\MoveAudioAction; use App\Filament\Components\Columns\TextColumn; use App\Filament\Components\Filters\NumberFilter; -use App\Filament\Components\Filters\TextFilter; use App\Filament\Components\Infolist\TextEntry; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\Audio\Pages\CreateAudio; @@ -238,8 +237,7 @@ class Audio extends BaseResource return array_merge( [ NumberFilter::make(AudioModel::ATTRIBUTE_SIZE) - ->labels(__('filament.filters.audio.size_from'), __('filament.filters.audio.size_to')) - ->attribute(AudioModel::ATTRIBUTE_SIZE), + ->labels(__('filament.filters.audio.size_from'), __('filament.filters.audio.size_to')), ], parent::getFilters(), ); diff --git a/app/Filament/Resources/Wiki/Audio/RelationManagers/VideoAudioRelationManager.php b/app/Filament/Resources/Wiki/Audio/RelationManagers/VideoAudioRelationManager.php index c1e63826e..1c9b5b3a7 100644 --- a/app/Filament/Resources/Wiki/Audio/RelationManagers/VideoAudioRelationManager.php +++ b/app/Filament/Resources/Wiki/Audio/RelationManagers/VideoAudioRelationManager.php @@ -4,18 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Audio\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Audio as AudioResource; -use App\Filament\Resources\Wiki\Video as VideoResource; +use App\Filament\RelationManagers\Wiki\VideoRelationManager; use App\Models\Wiki\Audio; use App\Models\Wiki\Video; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class VideoAudioRelationManager. */ -class VideoAudioRelationManager extends BaseRelationManager +class VideoAudioRelationManager extends VideoRelationManager { /** * The relationship the relation manager corresponds to. @@ -24,19 +21,6 @@ class VideoAudioRelationManager extends BaseRelationManager */ protected static string $relationship = Audio::RELATION_VIDEOS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return VideoResource::form($form); - } - /** * The index page of the resource. * @@ -49,12 +33,7 @@ class VideoAudioRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(VideoResource::getPluralLabel()) - ->modelLabel(VideoResource::getLabel()) - ->recordTitleAttribute(Video::ATTRIBUTE_FILENAME) ->inverseRelationship(Video::RELATION_AUDIO) - ->columns(VideoResource::table($table)->getColumns()) - ->defaultSort(Video::TABLE . '.' . Video::ATTRIBUTE_ID, 'desc') ); } @@ -68,8 +47,8 @@ class VideoAudioRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -90,7 +69,7 @@ class VideoAudioRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/ExternalResource.php b/app/Filament/Resources/Wiki/ExternalResource.php index 1922cf519..8d84c9b97 100644 --- a/app/Filament/Resources/Wiki/ExternalResource.php +++ b/app/Filament/Resources/Wiki/ExternalResource.php @@ -9,7 +9,7 @@ use App\Filament\Components\Columns\TextColumn; use App\Filament\Components\Fields\Select; use App\Filament\Components\Filters\NumberFilter; use App\Filament\Components\Infolist\TextEntry; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\ExternalResource\Pages\CreateExternalResource; use App\Filament\Resources\Wiki\ExternalResource\Pages\EditExternalResource; @@ -155,7 +155,7 @@ class ExternalResource extends BaseResource TextInput::make(AnimeResource::ATTRIBUTE_AS) ->label(__('filament.fields.anime.resources.as.name')) ->helperText(__('filament.fields.anime.resources.as.help')) - ->visibleOn(BaseRelationManager::class), + ->visibleOn(ResourceRelationManager::class), ]) ->columns(1); } @@ -197,7 +197,7 @@ class ExternalResource extends BaseResource TextColumn::make(AnimeResource::ATTRIBUTE_AS) ->label(__('filament.fields.anime.resources.as.name')) - ->visibleOn(BaseRelationManager::class) + ->visibleOn(ResourceRelationManager::class) ->placeholder('-'), ]); } @@ -271,8 +271,7 @@ class ExternalResource extends BaseResource ->options(ResourceSite::asSelectArray()), NumberFilter::make(ExternalResourceModel::ATTRIBUTE_EXTERNAL_ID) - ->labels(__('filament.filters.external_resource.external_id_from'), __('filament.filters.external_resource.external_id_to')) - ->attribute(ExternalResourceModel::ATTRIBUTE_EXTERNAL_ID), + ->labels(__('filament.filters.external_resource.external_id_from'), __('filament.filters.external_resource.external_id_to')), ], parent::getFilters(), ); diff --git a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/AnimeResourceRelationManager.php b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/AnimeResourceRelationManager.php index 9938c2f44..a78009372 100644 --- a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/AnimeResourceRelationManager.php +++ b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/AnimeResourceRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\ExternalResource\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime as AnimeResource; +use App\Filament\RelationManagers\Wiki\AnimeRelationManager; use App\Models\Wiki\Anime; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class AnimeResourceRelationManager. */ -class AnimeResourceRelationManager extends BaseRelationManager +class AnimeResourceRelationManager extends AnimeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class AnimeResourceRelationManager extends BaseRelationManager */ protected static string $relationship = ExternalResource::RELATION_ANIME; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return AnimeResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class AnimeResourceRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(AnimeResource::getPluralLabel()) - ->modelLabel(AnimeResource::getLabel()) - ->recordTitleAttribute(Anime::ATTRIBUTE_NAME) ->inverseRelationship(Anime::RELATION_RESOURCES) - ->columns(AnimeResource::table($table)->getColumns()) - ->defaultSort(Anime::TABLE . '.' . Anime::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class AnimeResourceRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class AnimeResourceRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/ArtistResourceRelationManager.php b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/ArtistResourceRelationManager.php index b44d234b2..80bf72573 100644 --- a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/ArtistResourceRelationManager.php +++ b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/ArtistResourceRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\ExternalResource\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Artist as ArtistResource; +use App\Filament\RelationManagers\Wiki\ArtistRelationManager; use App\Models\Wiki\Artist; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ArtistResourceRelationManager. */ -class ArtistResourceRelationManager extends BaseRelationManager +class ArtistResourceRelationManager extends ArtistRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ArtistResourceRelationManager extends BaseRelationManager */ protected static string $relationship = ExternalResource::RELATION_ARTISTS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ArtistResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ArtistResourceRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ArtistResource::getPluralLabel()) - ->modelLabel(ArtistResource::getLabel()) - ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) ->inverseRelationship(Artist::RELATION_RESOURCES) - ->columns(ArtistResource::table($table)->getColumns()) - ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ArtistResourceRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ArtistResourceRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/SongResourceRelationManager.php b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/SongResourceRelationManager.php index bc4d4093b..62540eeec 100644 --- a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/SongResourceRelationManager.php +++ b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/SongResourceRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\ExternalResource\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Song as SongResource; +use App\Filament\RelationManagers\Wiki\SongRelationManager; use App\Models\Wiki\Song; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class SongResourceRelationManager. */ -class SongResourceRelationManager extends BaseRelationManager +class SongResourceRelationManager extends SongRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class SongResourceRelationManager extends BaseRelationManager */ protected static string $relationship = ExternalResource::RELATION_SONGS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return SongResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class SongResourceRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(SongResource::getPluralLabel()) - ->modelLabel(SongResource::getLabel()) - ->recordTitleAttribute(Song::ATTRIBUTE_TITLE) ->inverseRelationship(Song::RELATION_RESOURCES) - ->columns(SongResource::table($table)->getColumns()) - ->defaultSort(Song::TABLE . '.' . Song::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class SongResourceRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class SongResourceRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/StudioResourceRelationManager.php b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/StudioResourceRelationManager.php index 677da0073..b30613b4b 100644 --- a/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/StudioResourceRelationManager.php +++ b/app/Filament/Resources/Wiki/ExternalResource/RelationManagers/StudioResourceRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\ExternalResource\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Studio as StudioResource; +use App\Filament\RelationManagers\Wiki\StudioRelationManager; use App\Models\Wiki\Studio; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class StudioResourceRelationManager. */ -class StudioResourceRelationManager extends BaseRelationManager +class StudioResourceRelationManager extends StudioRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class StudioResourceRelationManager extends BaseRelationManager */ protected static string $relationship = ExternalResource::RELATION_STUDIOS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return StudioResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class StudioResourceRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(StudioResource::getPluralLabel()) - ->modelLabel(StudioResource::getLabel()) - ->recordTitleAttribute(Studio::ATTRIBUTE_NAME) ->inverseRelationship(Studio::RELATION_RESOURCES) - ->columns(StudioResource::table($table)->getColumns()) - ->defaultSort(Studio::TABLE . '.' . Studio::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class StudioResourceRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class StudioResourceRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Group/RelationManagers/ThemeGroupRelationManager.php b/app/Filament/Resources/Wiki/Group/RelationManagers/ThemeGroupRelationManager.php index a636db7b8..38ba15a37 100644 --- a/app/Filament/Resources/Wiki/Group/RelationManagers/ThemeGroupRelationManager.php +++ b/app/Filament/Resources/Wiki/Group/RelationManagers/ThemeGroupRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Group\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Theme as ThemeResource; +use App\Filament\RelationManagers\Wiki\Anime\ThemeRelationManager; use App\Models\Wiki\Group; use App\Models\Wiki\Anime\AnimeTheme as ThemeModel; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ThemeGroupRelationManager. */ -class ThemeGroupRelationManager extends BaseRelationManager +class ThemeGroupRelationManager extends ThemeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ThemeGroupRelationManager extends BaseRelationManager */ protected static string $relationship = Group::RELATION_THEMES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ThemeResource::form($form); - } - /** * The index page of the Theme. * @@ -48,12 +33,7 @@ class ThemeGroupRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ThemeResource::getPluralLabel()) - ->modelLabel(ThemeResource::getLabel()) - ->recordTitleAttribute(ThemeModel::ATTRIBUTE_SLUG) ->inverseRelationship(ThemeModel::RELATION_GROUP) - ->columns(ThemeResource::table($table)->getColumns()) - ->defaultSort(ThemeModel::TABLE . '.' . ThemeModel::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ThemeGroupRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ThemeGroupRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Image/RelationManagers/AnimeImageRelationManager.php b/app/Filament/Resources/Wiki/Image/RelationManagers/AnimeImageRelationManager.php index 63e3692f7..345a66158 100644 --- a/app/Filament/Resources/Wiki/Image/RelationManagers/AnimeImageRelationManager.php +++ b/app/Filament/Resources/Wiki/Image/RelationManagers/AnimeImageRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Image\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime as AnimeResource; +use App\Filament\RelationManagers\Wiki\AnimeRelationManager; use App\Models\Wiki\Image; use App\Models\Wiki\Anime; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class AnimeImageRelationManager. */ -class AnimeImageRelationManager extends BaseRelationManager +class AnimeImageRelationManager extends AnimeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class AnimeImageRelationManager extends BaseRelationManager */ protected static string $relationship = Image::RELATION_ANIME; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return AnimeResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class AnimeImageRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(AnimeResource::getPluralLabel()) - ->modelLabel(AnimeResource::getLabel()) - ->recordTitleAttribute(Anime::ATTRIBUTE_NAME) ->inverseRelationship(Anime::RELATION_IMAGES) - ->columns(AnimeResource::table($table)->getColumns()) - ->defaultSort(Anime::TABLE . '.' . Anime::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class AnimeImageRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class AnimeImageRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Image/RelationManagers/ArtistImageRelationManager.php b/app/Filament/Resources/Wiki/Image/RelationManagers/ArtistImageRelationManager.php index 7d4201c7b..c37fe18a9 100644 --- a/app/Filament/Resources/Wiki/Image/RelationManagers/ArtistImageRelationManager.php +++ b/app/Filament/Resources/Wiki/Image/RelationManagers/ArtistImageRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Image\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Artist as ArtistResource; +use App\Filament\RelationManagers\Wiki\ArtistRelationManager; use App\Models\Wiki\Image; use App\Models\Wiki\Artist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ArtistImageRelationManager. */ -class ArtistImageRelationManager extends BaseRelationManager +class ArtistImageRelationManager extends ArtistRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ArtistImageRelationManager extends BaseRelationManager */ protected static string $relationship = Image::RELATION_ARTISTS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ArtistResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ArtistImageRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ArtistResource::getPluralLabel()) - ->modelLabel(ArtistResource::getLabel()) - ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) ->inverseRelationship(Artist::RELATION_IMAGES) - ->columns(ArtistResource::table($table)->getColumns()) - ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ArtistImageRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ArtistImageRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Image/RelationManagers/PlaylistImageRelationManager.php b/app/Filament/Resources/Wiki/Image/RelationManagers/PlaylistImageRelationManager.php index 40d6852fd..289ce9a8f 100644 --- a/app/Filament/Resources/Wiki/Image/RelationManagers/PlaylistImageRelationManager.php +++ b/app/Filament/Resources/Wiki/Image/RelationManagers/PlaylistImageRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Image\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\List\Playlist as PlaylistResource; +use App\Filament\RelationManagers\List\PlaylistRelationManager; use App\Models\Wiki\Image; use App\Models\List\Playlist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class PlaylistImageRelationManager. */ -class PlaylistImageRelationManager extends BaseRelationManager +class PlaylistImageRelationManager extends PlaylistRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class PlaylistImageRelationManager extends BaseRelationManager */ protected static string $relationship = Image::RELATION_PLAYLISTS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return PlaylistResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class PlaylistImageRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(PlaylistResource::getPluralLabel()) - ->modelLabel(PlaylistResource::getLabel()) - ->recordTitleAttribute(Playlist::ATTRIBUTE_NAME) ->inverseRelationship(Playlist::RELATION_IMAGES) - ->columns(PlaylistResource::table($table)->getColumns()) - ->defaultSort(Playlist::TABLE . '.' . Playlist::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class PlaylistImageRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class PlaylistImageRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Image/RelationManagers/StudioImageRelationManager.php b/app/Filament/Resources/Wiki/Image/RelationManagers/StudioImageRelationManager.php index d13c6958f..516fc0ee5 100644 --- a/app/Filament/Resources/Wiki/Image/RelationManagers/StudioImageRelationManager.php +++ b/app/Filament/Resources/Wiki/Image/RelationManagers/StudioImageRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Image\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Studio as StudioResource; +use App\Filament\RelationManagers\Wiki\StudioRelationManager; use App\Models\Wiki\Image; use App\Models\Wiki\Studio; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class StudioImageRelationManager. */ -class StudioImageRelationManager extends BaseRelationManager +class StudioImageRelationManager extends StudioRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class StudioImageRelationManager extends BaseRelationManager */ protected static string $relationship = Image::RELATION_STUDIOS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return StudioResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class StudioImageRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(StudioResource::getPluralLabel()) - ->modelLabel(StudioResource::getLabel()) - ->recordTitleAttribute(Studio::ATTRIBUTE_NAME) ->inverseRelationship(Studio::RELATION_IMAGES) - ->columns(StudioResource::table($table)->getColumns()) - ->defaultSort(Studio::TABLE . '.' . Studio::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class StudioImageRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class StudioImageRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Series/RelationManagers/AnimeSeriesRelationManager.php b/app/Filament/Resources/Wiki/Series/RelationManagers/AnimeSeriesRelationManager.php index 5ecd91380..7efb99489 100644 --- a/app/Filament/Resources/Wiki/Series/RelationManagers/AnimeSeriesRelationManager.php +++ b/app/Filament/Resources/Wiki/Series/RelationManagers/AnimeSeriesRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Series\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime as AnimeResource; +use App\Filament\RelationManagers\Wiki\AnimeRelationManager; use App\Models\Wiki\Series; use App\Models\Wiki\Anime; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class AnimeSeriesRelationManager. */ -class AnimeSeriesRelationManager extends BaseRelationManager +class AnimeSeriesRelationManager extends AnimeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class AnimeSeriesRelationManager extends BaseRelationManager */ protected static string $relationship = Series::RELATION_ANIME; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return AnimeResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class AnimeSeriesRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(AnimeResource::getPluralLabel()) - ->modelLabel(AnimeResource::getLabel()) - ->recordTitleAttribute(Anime::ATTRIBUTE_NAME) ->inverseRelationship(Anime::RELATION_SERIES) - ->columns(AnimeResource::table($table)->getColumns()) - ->defaultSort(Anime::TABLE . '.' . Anime::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class AnimeSeriesRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class AnimeSeriesRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Song/RelationManagers/ArtistSongRelationManager.php b/app/Filament/Resources/Wiki/Song/RelationManagers/ArtistSongRelationManager.php index d3e3c2e1f..442d7ddbe 100644 --- a/app/Filament/Resources/Wiki/Song/RelationManagers/ArtistSongRelationManager.php +++ b/app/Filament/Resources/Wiki/Song/RelationManagers/ArtistSongRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Song\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Artist as ArtistResource; +use App\Filament\RelationManagers\Wiki\ArtistRelationManager; use App\Models\Wiki\Song; use App\Models\Wiki\Artist; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ArtistSongRelationManager. */ -class ArtistSongRelationManager extends BaseRelationManager +class ArtistSongRelationManager extends ArtistRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ArtistSongRelationManager extends BaseRelationManager */ protected static string $relationship = Song::RELATION_ARTISTS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ArtistResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ArtistSongRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ArtistResource::getPluralLabel()) - ->modelLabel(ArtistResource::getLabel()) - ->recordTitleAttribute(Artist::ATTRIBUTE_NAME) ->inverseRelationship(Artist::RELATION_SONGS) - ->columns(ArtistResource::table($table)->getColumns()) - ->defaultSort(Artist::TABLE . '.' . Artist::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ArtistSongRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ArtistSongRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Song/RelationManagers/ResourceSongRelationManager.php b/app/Filament/Resources/Wiki/Song/RelationManagers/ResourceSongRelationManager.php index 9d729e853..d8f82f6d1 100644 --- a/app/Filament/Resources/Wiki/Song/RelationManagers/ResourceSongRelationManager.php +++ b/app/Filament/Resources/Wiki/Song/RelationManagers/ResourceSongRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Song\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\ExternalResource as ExternalResourceResource; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Models\Wiki\Song; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ResourceSongRelationManager. */ -class ResourceSongRelationManager extends BaseRelationManager +class ResourceSongRelationManager extends ResourceRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ResourceSongRelationManager extends BaseRelationManager */ protected static string $relationship = Song::RELATION_RESOURCES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ExternalResourceResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ResourceSongRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ExternalResourceResource::getPluralLabel()) - ->modelLabel(ExternalResourceResource::getLabel()) - ->recordTitleAttribute(ExternalResource::ATTRIBUTE_LINK) ->inverseRelationship(ExternalResource::RELATION_SONGS) - ->columns(ExternalResourceResource::table($table)->getColumns()) - ->defaultSort(ExternalResource::TABLE . '.' . ExternalResource::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ResourceSongRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ResourceSongRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Song/RelationManagers/ThemeSongRelationManager.php b/app/Filament/Resources/Wiki/Song/RelationManagers/ThemeSongRelationManager.php index 5db660c9a..b1c022742 100644 --- a/app/Filament/Resources/Wiki/Song/RelationManagers/ThemeSongRelationManager.php +++ b/app/Filament/Resources/Wiki/Song/RelationManagers/ThemeSongRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Song\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Theme as ThemeResource; +use App\Filament\RelationManagers\Wiki\Anime\ThemeRelationManager; use App\Models\Wiki\Anime\AnimeTheme as ThemeModel; use App\Models\Wiki\Song as SongModel; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ThemeSongRelationManager. */ -class ThemeSongRelationManager extends BaseRelationManager +class ThemeSongRelationManager extends ThemeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ThemeSongRelationManager extends BaseRelationManager */ protected static string $relationship = SongModel::RELATION_ANIMETHEMES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ThemeResource::form($form); - } - /** * The index page of the Theme. * @@ -48,12 +33,7 @@ class ThemeSongRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ThemeResource::getPluralLabel()) - ->modelLabel(ThemeResource::getLabel()) - ->recordTitleAttribute(ThemeModel::ATTRIBUTE_SLUG) ->inverseRelationship(ThemeModel::RELATION_SONG) - ->columns(ThemeResource::table($table)->getColumns()) - ->defaultSort(ThemeModel::TABLE . '.' . ThemeModel::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ThemeSongRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ThemeSongRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Studio/RelationManagers/AnimeStudioRelationManager.php b/app/Filament/Resources/Wiki/Studio/RelationManagers/AnimeStudioRelationManager.php index ff47be866..92650d734 100644 --- a/app/Filament/Resources/Wiki/Studio/RelationManagers/AnimeStudioRelationManager.php +++ b/app/Filament/Resources/Wiki/Studio/RelationManagers/AnimeStudioRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Studio\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime as AnimeResource; +use App\Filament\RelationManagers\Wiki\AnimeRelationManager; use App\Models\Wiki\Studio; use App\Models\Wiki\Anime; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class AnimeStudioRelationManager. */ -class AnimeStudioRelationManager extends BaseRelationManager +class AnimeStudioRelationManager extends AnimeRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class AnimeStudioRelationManager extends BaseRelationManager */ protected static string $relationship = Studio::RELATION_ANIME; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return AnimeResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class AnimeStudioRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(AnimeResource::getPluralLabel()) - ->modelLabel(AnimeResource::getLabel()) - ->recordTitleAttribute(Anime::ATTRIBUTE_NAME) ->inverseRelationship(Anime::RELATION_STUDIOS) - ->columns(AnimeResource::table($table)->getColumns()) - ->defaultSort(Anime::TABLE . '.' . Anime::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class AnimeStudioRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class AnimeStudioRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Studio/RelationManagers/ImageStudioRelationManager.php b/app/Filament/Resources/Wiki/Studio/RelationManagers/ImageStudioRelationManager.php index 79694f8a1..a207834fe 100644 --- a/app/Filament/Resources/Wiki/Studio/RelationManagers/ImageStudioRelationManager.php +++ b/app/Filament/Resources/Wiki/Studio/RelationManagers/ImageStudioRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Studio\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Image as ImageResource; +use App\Filament\RelationManagers\Wiki\ImageRelationManager; use App\Models\Wiki\Studio; use App\Models\Wiki\Image; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ImageStudioRelationManager. */ -class ImageStudioRelationManager extends BaseRelationManager +class ImageStudioRelationManager extends ImageRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ImageStudioRelationManager extends BaseRelationManager */ protected static string $relationship = Studio::RELATION_IMAGES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ImageResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ImageStudioRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ImageResource::getPluralLabel()) - ->modelLabel(ImageResource::getLabel()) - ->recordTitleAttribute(Image::ATTRIBUTE_PATH) ->inverseRelationship(Image::RELATION_STUDIOS) - ->columns(ImageResource::table($table)->getColumns()) - ->defaultSort(Image::TABLE . '.' . Image::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ImageStudioRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ImageStudioRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Studio/RelationManagers/ResourceStudioRelationManager.php b/app/Filament/Resources/Wiki/Studio/RelationManagers/ResourceStudioRelationManager.php index 228d1578f..81380dc1b 100644 --- a/app/Filament/Resources/Wiki/Studio/RelationManagers/ResourceStudioRelationManager.php +++ b/app/Filament/Resources/Wiki/Studio/RelationManagers/ResourceStudioRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Studio\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\ExternalResource as ExternalResourceResource; +use App\Filament\RelationManagers\Wiki\ResourceRelationManager; use App\Models\Wiki\Studio; use App\Models\Wiki\ExternalResource; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ResourceStudioRelationManager. */ -class ResourceStudioRelationManager extends BaseRelationManager +class ResourceStudioRelationManager extends ResourceRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ResourceStudioRelationManager extends BaseRelationManager */ protected static string $relationship = Studio::RELATION_RESOURCES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ExternalResourceResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class ResourceStudioRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ExternalResourceResource::getPluralLabel()) - ->modelLabel(ExternalResourceResource::getLabel()) - ->recordTitleAttribute(ExternalResource::ATTRIBUTE_LINK) ->inverseRelationship(ExternalResource::RELATION_STUDIOS) - ->columns(ExternalResourceResource::table($table)->getColumns()) - ->defaultSort(ExternalResource::TABLE . '.' . ExternalResource::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class ResourceStudioRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class ResourceStudioRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Video.php b/app/Filament/Resources/Wiki/Video.php index 9000e8c63..13212a0cb 100644 --- a/app/Filament/Resources/Wiki/Video.php +++ b/app/Filament/Resources/Wiki/Video.php @@ -323,8 +323,7 @@ class Video extends BaseResource return array_merge( [ NumberFilter::make(VideoModel::ATTRIBUTE_RESOLUTION) - ->labels(__('filament.filters.video.resolution_from'), __('filament.filters.video.resolution_to')) - ->attribute(VideoModel::ATTRIBUTE_RESOLUTION), + ->labels(__('filament.filters.video.resolution_from'), __('filament.filters.video.resolution_to')), Filter::make(VideoModel::ATTRIBUTE_NC) ->label(__('filament.fields.video.nc.name')) @@ -351,8 +350,7 @@ class Video extends BaseResource ->options(VideoSource::asSelectArray()), NumberFilter::make(VideoModel::ATTRIBUTE_SIZE) - ->labels(__('filament.filters.video.size_from'), __('filament.filters.video.size_to')) - ->attribute(VideoModel::ATTRIBUTE_SIZE), + ->labels(__('filament.filters.video.size_from'), __('filament.filters.video.size_to')), ], parent::getFilters(), ); diff --git a/app/Filament/Resources/Wiki/Video/RelationManagers/EntryVideoRelationManager.php b/app/Filament/Resources/Wiki/Video/RelationManagers/EntryVideoRelationManager.php index a858a61e5..1ad23ea3e 100644 --- a/app/Filament/Resources/Wiki/Video/RelationManagers/EntryVideoRelationManager.php +++ b/app/Filament/Resources/Wiki/Video/RelationManagers/EntryVideoRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Video\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Anime\Theme\Entry as EntryResource; +use App\Filament\RelationManagers\Wiki\Anime\Theme\EntryRelationManager; use App\Models\Wiki\Video; use App\Models\Wiki\Anime\Theme\AnimeThemeEntry; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class EntryVideoRelationManager. */ -class EntryVideoRelationManager extends BaseRelationManager +class EntryVideoRelationManager extends EntryRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class EntryVideoRelationManager extends BaseRelationManager */ protected static string $relationship = Video::RELATION_ANIMETHEMEENTRIES; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return EntryResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class EntryVideoRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(EntryResource::getPluralLabel()) - ->modelLabel(EntryResource::getLabel()) - ->recordTitleAttribute(AnimeThemeEntry::ATTRIBUTE_VERSION) ->inverseRelationship(AnimeThemeEntry::RELATION_VIDEOS) - ->columns(EntryResource::table($table)->getColumns()) - ->defaultSort(AnimeThemeEntry::TABLE . '.' . AnimeThemeEntry::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class EntryVideoRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class EntryVideoRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/Resources/Wiki/Video/RelationManagers/ScriptVideoRelationManager.php b/app/Filament/Resources/Wiki/Video/RelationManagers/ScriptVideoRelationManager.php index 97037580a..613132205 100644 --- a/app/Filament/Resources/Wiki/Video/RelationManagers/ScriptVideoRelationManager.php +++ b/app/Filament/Resources/Wiki/Video/RelationManagers/ScriptVideoRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Video\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\Wiki\Video\Script as ScriptResource; +use App\Filament\RelationManagers\Wiki\Video\ScriptRelationManager; use App\Models\Wiki\Video; use App\Models\Wiki\Video\VideoScript; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class ScriptVideoRelationManager. */ -class ScriptVideoRelationManager extends BaseRelationManager +class ScriptVideoRelationManager extends ScriptRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class ScriptVideoRelationManager extends BaseRelationManager */ protected static string $relationship = Video::RELATION_SCRIPT; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return ScriptResource::form($form); - } - /** * The index page of the resource. * @@ -48,11 +33,7 @@ class ScriptVideoRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(ScriptResource::getLabel()) - ->modelLabel(ScriptResource::getLabel()) - ->recordTitleAttribute(VideoScript::ATTRIBUTE_PATH) ->inverseRelationship(VideoScript::RELATION_VIDEO) - ->columns(ScriptResource::table($table)->getColumns()) ); } @@ -66,8 +47,8 @@ class ScriptVideoRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -88,7 +69,7 @@ class ScriptVideoRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection @@ -110,6 +91,9 @@ class ScriptVideoRelationManager extends BaseRelationManager */ public static function getHeaderActions(): array { - return ScriptResource::getHeaderActions(); + return array_merge( + parent::getHeaderActions(), + [], + ); } } diff --git a/app/Filament/Resources/Wiki/Video/RelationManagers/TrackVideoRelationManager.php b/app/Filament/Resources/Wiki/Video/RelationManagers/TrackVideoRelationManager.php index 39b1dd02d..ad3d7978f 100644 --- a/app/Filament/Resources/Wiki/Video/RelationManagers/TrackVideoRelationManager.php +++ b/app/Filament/Resources/Wiki/Video/RelationManagers/TrackVideoRelationManager.php @@ -4,17 +4,15 @@ declare(strict_types=1); namespace App\Filament\Resources\Wiki\Video\RelationManagers; -use App\Filament\Resources\BaseRelationManager; -use App\Filament\Resources\List\Playlist\Track as TrackResource; +use App\Filament\RelationManagers\List\Playlist\TrackRelationManager; use App\Models\Wiki\Video; use App\Models\List\Playlist\PlaylistTrack; -use Filament\Forms\Form; use Filament\Tables\Table; /** * Class TrackVideoRelationManager. */ -class TrackVideoRelationManager extends BaseRelationManager +class TrackVideoRelationManager extends TrackRelationManager { /** * The relationship the relation manager corresponds to. @@ -23,19 +21,6 @@ class TrackVideoRelationManager extends BaseRelationManager */ protected static string $relationship = Video::RELATION_TRACKS; - /** - * The form to the actions. - * - * @param Form $form - * @return Form - * - * @noinspection PhpMissingParentCallCommonInspection - */ - public function form(Form $form): Form - { - return TrackResource::form($form); - } - /** * The index page of the resource. * @@ -48,12 +33,7 @@ class TrackVideoRelationManager extends BaseRelationManager { return parent::table( $table - ->heading(TrackResource::getPluralLabel()) - ->modelLabel(TrackResource::getLabel()) - ->recordTitleAttribute(PlaylistTrack::ATTRIBUTE_HASHID) ->inverseRelationship(PlaylistTrack::RELATION_VIDEO) - ->columns(TrackResource::table($table)->getColumns()) - ->defaultSort(PlaylistTrack::TABLE . '.' . PlaylistTrack::ATTRIBUTE_ID, 'desc') ); } @@ -67,8 +47,8 @@ class TrackVideoRelationManager extends BaseRelationManager public static function getFilters(): array { return array_merge( - parent::getFilters(), [], + parent::getFilters(), ); } @@ -89,7 +69,7 @@ class TrackVideoRelationManager extends BaseRelationManager /** * Get the bulk actions available for the relation. - * + * * @return array * * @noinspection PhpMissingParentCallCommonInspection diff --git a/app/Filament/TableActions/Storage/Wiki/Video/Script/UploadScriptTableAction.php b/app/Filament/TableActions/Storage/Wiki/Video/Script/UploadScriptTableAction.php index 56bcbfcac..4aefc047c 100644 --- a/app/Filament/TableActions/Storage/Wiki/Video/Script/UploadScriptTableAction.php +++ b/app/Filament/TableActions/Storage/Wiki/Video/Script/UploadScriptTableAction.php @@ -6,7 +6,7 @@ namespace App\Filament\TableActions\Storage\Wiki\Video\Script; use App\Actions\Storage\Wiki\Video\Script\UploadScriptAction as UploadScript; use App\Constants\Config\VideoConstants; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\BaseRelationManager; use App\Filament\Resources\Wiki\Video\Script\Pages\ListScripts; use App\Models\Wiki\Video; use App\Filament\TableActions\Storage\Base\UploadTableAction; diff --git a/app/Filament/TableActions/Storage/Wiki/Video/UploadVideoTableAction.php b/app/Filament/TableActions/Storage/Wiki/Video/UploadVideoTableAction.php index 13fa87e92..f95b1ff2d 100644 --- a/app/Filament/TableActions/Storage/Wiki/Video/UploadVideoTableAction.php +++ b/app/Filament/TableActions/Storage/Wiki/Video/UploadVideoTableAction.php @@ -10,7 +10,7 @@ use App\Enums\Models\Wiki\AnimeSeason; use App\Enums\Models\Wiki\VideoOverlap; use App\Enums\Models\Wiki\VideoSource; use App\Filament\Components\Fields\Select; -use App\Filament\Resources\BaseRelationManager; +use App\Filament\RelationManagers\BaseRelationManager; use App\Filament\Resources\Wiki\Video\Pages\ListVideos; use App\Models\Wiki\Anime\Theme\AnimeThemeEntry; use App\Models\Wiki\Video; diff --git a/app/Filament/Widgets/BaseChartWidget.php b/app/Filament/Widgets/BaseChartWidget.php index 43372e907..03d307766 100644 --- a/app/Filament/Widgets/BaseChartWidget.php +++ b/app/Filament/Widgets/BaseChartWidget.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace App\Filament\Widgets; -use App\Models\BaseModel; use Flowframe\Trend\Trend; use Illuminate\Support\Collection; use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget; @@ -14,6 +13,8 @@ use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget; */ class BaseChartWidget extends ApexChartWidget { + protected static bool $isLazy = false; + /** * Get the resources count created per month. * diff --git a/app/Filament/Widgets/BaseStatsWidget.php b/app/Filament/Widgets/BaseStatsWidget.php index 89ee927e5..dfa218f35 100644 --- a/app/Filament/Widgets/BaseStatsWidget.php +++ b/app/Filament/Widgets/BaseStatsWidget.php @@ -11,4 +11,5 @@ use Filament\Widgets\StatsOverviewWidget; */ class BaseStatsWidget extends StatsOverviewWidget { + protected static bool $isLazy = false; } \ No newline at end of file diff --git a/tests/Feature/Jobs/Discord/DiscordThreadTest.php b/tests/Feature/Jobs/Discord/DiscordThreadTest.php index 7d5d6b64b..970868d3c 100644 --- a/tests/Feature/Jobs/Discord/DiscordThreadTest.php +++ b/tests/Feature/Jobs/Discord/DiscordThreadTest.php @@ -12,6 +12,7 @@ use App\Models\Discord\DiscordThread; use App\Models\Wiki\Anime; use Illuminate\Support\Facades\Bus; use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Http; use Laravel\Pennant\Feature; use Tests\TestCase; @@ -33,6 +34,7 @@ class DiscordThreadTest extends TestCase Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); + Http::fake(); Event::fakeExcept(DiscordThreadDeleted::class); $thread->delete(); @@ -53,6 +55,7 @@ class DiscordThreadTest extends TestCase Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); + Http::fake(); Event::fakeExcept(DiscordThreadUpdated::class); $changes = DiscordThread::factory()