From ac38b2711b08abd193c5d967a88f8596427bee48 Mon Sep 17 00:00:00 2001 From: Kyrch Date: Mon, 22 Apr 2024 11:03:19 -0300 Subject: [PATCH] feat(filament): added timestamps panel and avatar provider (#657) * feat(filament): timestamps panel * feat(filament): using gravatar image as avatar * fix(filament): added isServing for filament policies and force delete any * feat(filament): resource icons --- app/Filament/Resources/Admin/Announcement.php | 38 ++++++-- app/Filament/Resources/Admin/Dump.php | 38 ++++++-- app/Filament/Resources/Admin/Feature.php | 19 ++-- .../Resources/Admin/FeaturedTheme.php | 73 +++++++++------- app/Filament/Resources/Auth/Permission.php | 19 ++-- app/Filament/Resources/Auth/Role.php | 21 +++-- app/Filament/Resources/Auth/User.php | 44 ++++++++-- .../Resources/Base/BaseViewResource.php | 11 ++- .../Resources/BaseRelationManager.php | 26 ++++-- app/Filament/Resources/BaseResource.php | 54 ++++++++++-- app/Filament/Resources/Document/Page.php | 38 ++++++-- app/Filament/Resources/List/Playlist.php | 38 ++++++-- .../Resources/List/Playlist/Track.php | 38 ++++++-- app/Filament/Resources/Wiki/Anime.php | 38 ++++++-- app/Filament/Resources/Wiki/Anime/Synonym.php | 38 ++++++-- app/Filament/Resources/Wiki/Anime/Theme.php | 38 ++++++-- .../Resources/Wiki/Anime/Theme/Entry.php | 38 ++++++-- app/Filament/Resources/Wiki/Artist.php | 38 ++++++-- app/Filament/Resources/Wiki/Audio.php | 80 ++++++++++------- .../Resources/Wiki/ExternalResource.php | 40 +++++++-- app/Filament/Resources/Wiki/Image.php | 38 ++++++-- app/Filament/Resources/Wiki/Series.php | 38 ++++++-- app/Filament/Resources/Wiki/Song.php | 38 ++++++-- app/Filament/Resources/Wiki/Studio.php | 39 +++++++-- app/Filament/Resources/Wiki/Video.php | 86 ++++++++++++------- app/Filament/Resources/Wiki/Video/Script.php | 38 ++++++-- app/Models/Auth/User.php | 15 +++- app/Policies/Admin/AnnouncementPolicy.php | 11 +++ app/Policies/Admin/DumpPolicy.php | 11 +++ app/Policies/Admin/FeaturePolicy.php | 3 +- app/Policies/Admin/FeaturedThemePolicy.php | 14 ++- app/Policies/Auth/PermissionPolicy.php | 11 +++ app/Policies/Auth/RolePolicy.php | 11 +++ app/Policies/Document/PagePolicy.php | 11 +++ .../List/Playlist/PlaylistTrackPolicy.php | 13 +++ app/Policies/List/PlaylistPolicy.php | 31 +++++-- .../Wiki/Anime/AnimeSynonymPolicy.php | 11 +++ app/Policies/Wiki/Anime/AnimeThemePolicy.php | 11 +++ .../Anime/Theme/AnimeThemeEntryPolicy.php | 11 +++ app/Policies/Wiki/AnimePolicy.php | 11 +++ app/Policies/Wiki/ArtistPolicy.php | 11 +++ app/Policies/Wiki/AudioPolicy.php | 11 +++ app/Policies/Wiki/ExternalResourcePolicy.php | 11 +++ app/Policies/Wiki/ImagePolicy.php | 11 +++ app/Policies/Wiki/SeriesPolicy.php | 11 +++ app/Policies/Wiki/SongPolicy.php | 11 +++ app/Policies/Wiki/StudioPolicy.php | 11 +++ app/Policies/Wiki/Video/VideoScriptPolicy.php | 11 +++ app/Policies/Wiki/VideoPolicy.php | 11 +++ lang/en/filament.php | 44 +++++++++- 50 files changed, 1100 insertions(+), 262 deletions(-) diff --git a/app/Filament/Resources/Admin/Announcement.php b/app/Filament/Resources/Admin/Announcement.php index 653961e57..9efe55d0a 100644 --- a/app/Filament/Resources/Admin/Announcement.php +++ b/app/Filament/Resources/Admin/Announcement.php @@ -12,6 +12,8 @@ use App\Models\Admin\Announcement as AnnouncementModel; use Filament\Forms\Components\MarkdownEditor; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -27,13 +29,6 @@ class Announcement extends BaseResource */ protected static ?string $model = AnnouncementModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -70,6 +65,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.admin'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.announcements'); + } + /** * Get the slug (URI key) for the resource. * @@ -143,6 +150,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Admin/Dump.php b/app/Filament/Resources/Admin/Dump.php index 93105634b..4b4f9bade 100644 --- a/app/Filament/Resources/Admin/Dump.php +++ b/app/Filament/Resources/Admin/Dump.php @@ -17,6 +17,8 @@ use Filament\Tables\Actions\ActionGroup; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -32,13 +34,6 @@ class Dump extends BaseResource */ protected static ?string $model = DumpModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -75,6 +70,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.admin'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.dumps'); + } + /** * Get the slug (URI key) for the resource. * @@ -150,6 +157,23 @@ public static function table(Table $table): Table ->headerActions(static::getHeaderActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Admin/Feature.php b/app/Filament/Resources/Admin/Feature.php index 192280f5a..30098ff62 100644 --- a/app/Filament/Resources/Admin/Feature.php +++ b/app/Filament/Resources/Admin/Feature.php @@ -27,13 +27,6 @@ class Feature extends BaseResource */ protected static ?string $model = FeatureModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -70,6 +63,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.admin'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.features'); + } + /** * Get the slug (URI key) for the resource. * diff --git a/app/Filament/Resources/Admin/FeaturedTheme.php b/app/Filament/Resources/Admin/FeaturedTheme.php index 7148cf99f..4091898be 100644 --- a/app/Filament/Resources/Admin/FeaturedTheme.php +++ b/app/Filament/Resources/Admin/FeaturedTheme.php @@ -15,16 +15,15 @@ use App\Filament\Resources\Wiki\Video as VideoResource; use App\Models\Admin\FeaturedTheme as FeaturedThemeModel; use App\Models\Auth\User; -use App\Models\Wiki\Anime; -use App\Models\Wiki\Anime\AnimeTheme; use App\Models\Wiki\Anime\Theme\AnimeThemeEntry as EntryModel; use App\Models\Wiki\Video; use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Select; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; -use Illuminate\Support\Arr; use Illuminate\Support\Str; /** @@ -39,13 +38,6 @@ class FeaturedTheme extends BaseResource */ protected static ?string $model = FeaturedThemeModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -82,6 +74,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.admin'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.featured_themes'); + } + /** * Get the slug (URI key) for the resource. * @@ -155,22 +159,14 @@ public static function form(Form $form): Form Select::make(FeaturedThemeModel::ATTRIBUTE_ENTRY) ->label(__('filament.resources.singularLabel.anime_theme_entry')) - ->relationship(FeaturedThemeModel::RELATION_ENTRY, EntryModel::ATTRIBUTE_VERSION) + ->relationship(FeaturedThemeModel::RELATION_ENTRY, EntryModel::ATTRIBUTE_ID) ->searchable() ->getSearchResultsUsing(function (string $search) { - $arr = []; - $animeResult = Anime::query()->where(Anime::ATTRIBUTE_NAME, 'like', "%{$search}%")->limit(50)->get(); - - $animeResult->each(function (Anime $anime) use (&$arr) { - $anime->animethemes->each(function (AnimeTheme $theme) use ($anime, &$arr) { - $theme->animethemeentries->each(function (EntryModel $entry) use ($anime, $theme, &$arr) { - $version = $entry->version ? " v{$entry->version}" : ''; - Arr::set($arr, $entry->entry_id, "{$anime->getName()} {$theme->slug}{$version}"); - }); - }); - }); - - return $arr; + return EntryModel::search($search) + ->get() + ->load(EntryModel::RELATION_ANIME_SHALLOW) + ->mapWithKeys(fn (EntryModel $entry) => [$entry->entry_id => $entry->getName()]) + ->toArray(); }), Select::make(FeaturedThemeModel::ATTRIBUTE_USER) @@ -200,13 +196,13 @@ public static function table(Table $table): Table TextColumn::make(FeaturedThemeModel::ATTRIBUTE_START_AT) ->label(__('filament.fields.featured_theme.start_at.name')) ->sortable() - ->dateTime() + ->date() ->toggleable(), TextColumn::make(FeaturedThemeModel::ATTRIBUTE_END_AT) ->label(__('filament.fields.featured_theme.end_at.name')) ->sortable() - ->dateTime() + ->date() ->toggleable(), TextColumn::make(FeaturedThemeModel::RELATION_VIDEO.'.'.Video::ATTRIBUTE_FILENAME) @@ -217,13 +213,7 @@ public static function table(Table $table): Table TextColumn::make(FeaturedThemeModel::RELATION_ENTRY.'.'.EntryModel::ATTRIBUTE_ID) ->label(__('filament.resources.singularLabel.anime_theme_entry')) ->toggleable() - ->formatStateUsing(function (string $state) { - $entry = EntryModel::find(intval($state)); - $version = $entry->version ? " v{$entry->version}" : ''; - $theme = $entry->animetheme; - - return "{$theme->anime->getName()} {$theme->slug}{$version}"; - }) + ->formatStateUsing(fn (string $state) => EntryModel::find(intval($state))->load(EntryModel::RELATION_ANIME)->getName()) ->urlToRelated(EntryResource::class, FeaturedThemeModel::RELATION_ENTRY), TextColumn::make(FeaturedThemeModel::RELATION_USER.'.'.User::ATTRIBUTE_NAME) @@ -237,6 +227,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Auth/Permission.php b/app/Filament/Resources/Auth/Permission.php index 208a1461c..52ce4d8df 100644 --- a/app/Filament/Resources/Auth/Permission.php +++ b/app/Filament/Resources/Auth/Permission.php @@ -33,13 +33,6 @@ class Permission extends BaseResource */ protected static ?string $model = PermissionModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -76,6 +69,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.auth'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.permissions'); + } + /** * Get the slug (URI key) for the resource. * diff --git a/app/Filament/Resources/Auth/Role.php b/app/Filament/Resources/Auth/Role.php index f080d436f..3f130f017 100644 --- a/app/Filament/Resources/Auth/Role.php +++ b/app/Filament/Resources/Auth/Role.php @@ -37,13 +37,6 @@ class Role extends BaseResource */ protected static ?string $model = RoleModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -80,6 +73,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.auth'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.roles'); + } + /** * Get the slug (URI key) for the resource. * @@ -137,7 +142,7 @@ public static function form(Form $form): Form ->numeric() ->minValue(1) ->nullable() - ->rules(['nullable', 'integer', 'min:1']) + ->rules(['nullable', 'integer', 'min:1']), ]) ->columns(1); } diff --git a/app/Filament/Resources/Auth/User.php b/app/Filament/Resources/Auth/User.php index 04740cf95..65122280e 100644 --- a/app/Filament/Resources/Auth/User.php +++ b/app/Filament/Resources/Auth/User.php @@ -19,8 +19,11 @@ use App\Models\Auth\User as UserModel; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Actions\ActionGroup; +use Filament\Tables\Columns\ImageColumn; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -36,13 +39,6 @@ class User extends BaseResource */ protected static ?string $model = UserModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -79,6 +75,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.auth'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.users'); + } + /** * Get the slug (URI key) for the resource. * @@ -147,6 +155,11 @@ public static function table(Table $table): Table ->label(__('filament.fields.base.id')) ->sortable(), + ImageColumn::make('avatar') + ->label(__('filament.fields.user.avatar')) + ->defaultImageUrl(fn (UserModel $model) => $model->getFilamentAvatarUrl()) + ->circular(), + TextColumn::make(UserModel::ATTRIBUTE_NAME) ->label(__('filament.fields.user.name')) ->sortable() @@ -165,6 +178,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Base/BaseViewResource.php b/app/Filament/Resources/Base/BaseViewResource.php index 751b3ed38..95b4921c3 100644 --- a/app/Filament/Resources/Base/BaseViewResource.php +++ b/app/Filament/Resources/Base/BaseViewResource.php @@ -5,6 +5,8 @@ namespace App\Filament\Resources\Base; use Filament\Actions\EditAction; +use Filament\Actions\ForceDeleteAction; +use Filament\Actions\RestoreAction; use Filament\Resources\Pages\ViewRecord; /** @@ -22,7 +24,14 @@ class BaseViewResource extends ViewRecord protected function getHeaderActions(): array { return [ - EditAction::make(), + EditAction::make() + ->label(__('filament.actions.base.edit')), + + ForceDeleteAction::make() + ->label(__('filament.actions.base.forcedelete')), + + RestoreAction::make() + ->label(__('filament.actions.base.restore')), ]; } } diff --git a/app/Filament/Resources/BaseRelationManager.php b/app/Filament/Resources/BaseRelationManager.php index bfa15ff62..957fb1964 100644 --- a/app/Filament/Resources/BaseRelationManager.php +++ b/app/Filament/Resources/BaseRelationManager.php @@ -66,9 +66,14 @@ public static function getFilters(): array public static function getActions(): array { return [ - ViewAction::make(), - EditAction::make(), - DetachAction::make(), + ViewAction::make() + ->label(__('filament.actions.base.view')), + + EditAction::make() + ->label(__('filament.actions.base.edit')), + + DetachAction::make() + ->label(__('filament.actions.base.detach')), ]; } @@ -83,10 +88,17 @@ public static function getBulkActions(): array { return [ BulkActionGroup::make([ - DeleteBulkAction::make(), - ForceDeleteBulkAction::make(), - RestoreBulkAction::make(), - DetachBulkAction::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')), ]), ]; } diff --git a/app/Filament/Resources/BaseResource.php b/app/Filament/Resources/BaseResource.php index 1c1ac4b84..4261b61cc 100644 --- a/app/Filament/Resources/BaseResource.php +++ b/app/Filament/Resources/BaseResource.php @@ -4,11 +4,16 @@ namespace App\Filament\Resources; +use App\Models\BaseModel; +use Filament\Infolists\Components\TextEntry; use Filament\Resources\Resource; use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DeleteAction; use Filament\Tables\Actions\DeleteBulkAction; use Filament\Tables\Actions\EditAction; +use Filament\Tables\Actions\ForceDeleteAction; use Filament\Tables\Actions\ForceDeleteBulkAction; +use Filament\Tables\Actions\RestoreAction; use Filament\Tables\Actions\RestoreBulkAction; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Filters\TrashedFilter; @@ -38,6 +43,28 @@ public static function table(Table $table): Table ->defaultPaginationPageOption(25); } + /** + * The panel for timestamp fields. + * + * @return array + */ + public static function timestamps(): array + { + return [ + TextEntry::make(BaseModel::ATTRIBUTE_CREATED_AT) + ->label(__('filament.fields.base.created_at')) + ->dateTime(), + + TextEntry::make(BaseModel::ATTRIBUTE_UPDATED_AT) + ->label(__('filament.fields.base.updated_at')) + ->dateTime(), + + TextEntry::make(BaseModel::ATTRIBUTE_DELETED_AT) + ->label(__('filament.fields.base.deleted_at')) + ->dateTime(), + ]; + } + /** * Get the filters available for the resource. * @@ -62,8 +89,20 @@ public static function getFilters(): array public static function getActions(): array { return [ - ViewAction::make(), - EditAction::make(), + ViewAction::make() + ->label(__('filament.actions.base.view')), + + EditAction::make() + ->label(__('filament.actions.base.edit')), + + DeleteAction::make() + ->label(__('filament.actions.base.delete')), + + ForceDeleteAction::make() + ->label(__('filament.actions.base.forcedelete')), + + RestoreAction::make() + ->label(__('filament.actions.base.restore')), ]; } @@ -78,9 +117,14 @@ public static function getBulkActions(): array { return [ BulkActionGroup::make([ - DeleteBulkAction::make(), - ForceDeleteBulkAction::make(), - RestoreBulkAction::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')), ]), ]; } diff --git a/app/Filament/Resources/Document/Page.php b/app/Filament/Resources/Document/Page.php index 5928b4185..5659d13fd 100644 --- a/app/Filament/Resources/Document/Page.php +++ b/app/Filament/Resources/Document/Page.php @@ -14,6 +14,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; use Illuminate\Support\Str; @@ -31,13 +33,6 @@ class Page extends BaseResource */ protected static ?string $model = PageModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -74,6 +69,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.document'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.pages'); + } + /** * Get the slug (URI key) for the resource. * @@ -178,6 +185,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/List/Playlist.php b/app/Filament/Resources/List/Playlist.php index 3c07b1b7a..cff3eb9be 100644 --- a/app/Filament/Resources/List/Playlist.php +++ b/app/Filament/Resources/List/Playlist.php @@ -21,6 +21,8 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\SelectColumn; use Filament\Tables\Columns\TextColumn; @@ -39,13 +41,6 @@ class Playlist extends BaseResource */ protected static ?string $model = PlaylistModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -82,6 +77,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.list'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.playlists'); + } + /** * Get the slug (URI key) for the resource. * @@ -211,6 +218,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/List/Playlist/Track.php b/app/Filament/Resources/List/Playlist/Track.php index 19cc94fdf..a736206d7 100644 --- a/app/Filament/Resources/List/Playlist/Track.php +++ b/app/Filament/Resources/List/Playlist/Track.php @@ -18,6 +18,8 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -33,13 +35,6 @@ class Track extends BaseResource */ protected static ?string $model = TrackModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -76,6 +71,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.list'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.playlist_tracks'); + } + /** * Get the slug (URI key) for the resource. * @@ -180,6 +187,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Anime.php b/app/Filament/Resources/Wiki/Anime.php index d39734843..c62a95b66 100644 --- a/app/Filament/Resources/Wiki/Anime.php +++ b/app/Filament/Resources/Wiki/Anime.php @@ -34,6 +34,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -57,13 +59,6 @@ class Anime extends BaseResource */ protected static ?string $model = AnimeModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -100,6 +95,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.anime'); + } + /** * Get the title attribute for the resource. * @@ -273,6 +280,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Anime/Synonym.php b/app/Filament/Resources/Wiki/Anime/Synonym.php index 1d0b4e89a..52af09440 100644 --- a/app/Filament/Resources/Wiki/Anime/Synonym.php +++ b/app/Filament/Resources/Wiki/Anime/Synonym.php @@ -16,6 +16,8 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -31,13 +33,6 @@ class Synonym extends BaseResource */ protected static ?string $model = SynonymModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -74,6 +69,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.anime_synonyms'); + } + /** * Get the slug (URI key) for the resource. * @@ -158,6 +165,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Anime/Theme.php b/app/Filament/Resources/Wiki/Anime/Theme.php index 28c5ac97d..afbd486aa 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme.php +++ b/app/Filament/Resources/Wiki/Anime/Theme.php @@ -22,6 +22,8 @@ use Filament\Forms\Form; use Filament\Forms\Get; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\SelectColumn; use Filament\Tables\Columns\TextColumn; @@ -41,13 +43,6 @@ class Theme extends BaseResource */ protected static ?string $model = ThemeModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -84,6 +79,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.anime_themes'); + } + /** * Get the slug (URI key) for the resource. * @@ -212,6 +219,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Set the theme slug. * diff --git a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php index f0395cb24..2314992c1 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php +++ b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php @@ -20,6 +20,8 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\CheckboxColumn; use Filament\Tables\Columns\TextColumn; @@ -38,13 +40,6 @@ class Entry extends BaseResource */ protected static ?string $model = EntryModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -81,6 +76,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.anime_theme_entries'); + } + /** * Get the title for the resource. * @@ -255,6 +262,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Artist.php b/app/Filament/Resources/Wiki/Artist.php index 657118f0e..b9d1e488c 100644 --- a/app/Filament/Resources/Wiki/Artist.php +++ b/app/Filament/Resources/Wiki/Artist.php @@ -24,6 +24,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -44,13 +46,6 @@ class Artist extends BaseResource */ protected static ?string $model = ArtistModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -87,6 +82,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.artists'); + } + /** * Get the title attribute for the resource. * @@ -210,6 +217,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Audio.php b/app/Filament/Resources/Wiki/Audio.php index 2b46777d2..6bd13cf4b 100644 --- a/app/Filament/Resources/Wiki/Audio.php +++ b/app/Filament/Resources/Wiki/Audio.php @@ -19,6 +19,9 @@ use App\Models\Wiki\Video; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Components\TextEntry; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -37,13 +40,6 @@ class Audio extends BaseResource */ protected static ?string $model = AudioModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -80,6 +76,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.audios'); + } + /** * Get the slug (URI key) for the resource. * @@ -155,34 +163,11 @@ public static function table(Table $table): Table TextColumn::make(AudioModel::ATTRIBUTE_ID) ->label(__('filament.fields.base.id')) ->sortable(), - - TextColumn::make(AudioModel::ATTRIBUTE_BASENAME) - ->label(__('filament.fields.audio.basename.name')) - ->copyable() - ->hidden(), TextColumn::make(AudioModel::ATTRIBUTE_FILENAME) ->label(__('filament.fields.audio.filename.name')) ->sortable() ->copyable(), - - TextColumn::make(AudioModel::ATTRIBUTE_PATH) - ->label(__('filament.fields.audio.path.name')) - ->sortable() - ->copyable() - ->hidden(), - - TextColumn::make(AudioModel::ATTRIBUTE_SIZE) - ->label(__('filament.fields.audio.size.name')) - ->sortable() - ->copyable() - ->hidden(), - - TextColumn::make(AudioModel::ATTRIBUTE_MIMETYPE) - ->label(__('filament.fields.audio.mimetype.name')) - ->sortable() - ->copyable() - ->hidden(), ]) ->defaultSort(AudioModel::ATTRIBUTE_ID, 'desc') ->filters(static::getFilters()) @@ -191,6 +176,41 @@ public static function table(Table $table): Table ->headerActions(static::getHeaderActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.file_properties')) + ->schema([ + TextEntry::make(AudioModel::ATTRIBUTE_BASENAME) + ->label(__('filament.fields.audio.basename.name')), + + TextEntry::make(AudioModel::ATTRIBUTE_FILENAME) + ->label(__('filament.fields.audio.filename.name')), + + TextEntry::make(AudioModel::ATTRIBUTE_PATH) + ->label(__('filament.fields.audio.path.name')), + + TextEntry::make(AudioModel::ATTRIBUTE_SIZE) + ->label(__('filament.fields.audio.size.name')), + + TextEntry::make(AudioModel::ATTRIBUTE_MIMETYPE) + ->label(__('filament.fields.audio.mimetype.name')), + ]), + + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/ExternalResource.php b/app/Filament/Resources/Wiki/ExternalResource.php index 5a881032d..de0d12b40 100644 --- a/app/Filament/Resources/Wiki/ExternalResource.php +++ b/app/Filament/Resources/Wiki/ExternalResource.php @@ -21,6 +21,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\SelectColumn; use Filament\Tables\Columns\TextColumn; @@ -39,13 +41,6 @@ class ExternalResource extends BaseResource */ protected static ?string $model = ExternalResourceModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -77,11 +72,23 @@ public static function getPluralLabel(): string * * @noinspection PhpMissingParentCallCommonInspection */ - public static function getNavigationGroup(): ?string + public static function getNavigationGroup(): string { return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.external_resources'); + } + /** * Get the slug (URI key) for the resource. * @@ -196,6 +203,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Image.php b/app/Filament/Resources/Wiki/Image.php index 8eb093668..53bb284a9 100644 --- a/app/Filament/Resources/Wiki/Image.php +++ b/app/Filament/Resources/Wiki/Image.php @@ -17,6 +17,8 @@ use App\Models\Wiki\Image as ImageModel; use Filament\Forms\Components\Select; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\ImageColumn; use Filament\Tables\Columns\SelectColumn; @@ -37,13 +39,6 @@ class Image extends BaseResource */ protected static ?string $model = ImageModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -80,6 +75,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.images'); + } + /** * Get the slug (URI key) for the resource. * @@ -159,6 +166,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Series.php b/app/Filament/Resources/Wiki/Series.php index 46c7f2884..d3a6a63d1 100644 --- a/app/Filament/Resources/Wiki/Series.php +++ b/app/Filament/Resources/Wiki/Series.php @@ -14,6 +14,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -32,13 +34,6 @@ class Series extends BaseResource */ protected static ?string $model = SeriesModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -75,6 +70,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.series'); + } + /** * Get the slug (URI key) for the resource. * @@ -189,6 +196,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Song.php b/app/Filament/Resources/Wiki/Song.php index bf4385083..c50a114c2 100644 --- a/app/Filament/Resources/Wiki/Song.php +++ b/app/Filament/Resources/Wiki/Song.php @@ -19,6 +19,8 @@ use App\Pivots\Wiki\SongResource; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -37,13 +39,6 @@ class Song extends BaseResource */ protected static ?string $model = SongModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -80,6 +75,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.songs'); + } + /** * Get the slug (URI key) for the resource. * @@ -188,6 +195,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Studio.php b/app/Filament/Resources/Wiki/Studio.php index 2f0d21893..4922c9695 100644 --- a/app/Filament/Resources/Wiki/Studio.php +++ b/app/Filament/Resources/Wiki/Studio.php @@ -9,7 +9,6 @@ use App\Filament\Actions\Models\Wiki\Studio\AttachStudioImageAction; use App\Filament\Actions\Models\Wiki\Studio\AttachStudioResourceAction; use App\Filament\Actions\Models\Wiki\Studio\BackfillStudioAction; -use App\Filament\Resources\BaseRelationManager; use App\Filament\Resources\BaseResource; use App\Filament\Resources\Wiki\ExternalResource\RelationManagers\StudioResourceRelationManager; use App\Filament\Resources\Wiki\Studio\Pages\CreateStudio; @@ -24,6 +23,8 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Set; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -44,13 +45,6 @@ class Studio extends BaseResource */ protected static ?string $model = StudioModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -87,6 +81,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.studios'); + } + /** * Get the slug (URI key) for the resource. * @@ -185,6 +191,23 @@ public static function table(Table $table): Table ->bulkActions(static::getBulkActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * diff --git a/app/Filament/Resources/Wiki/Video.php b/app/Filament/Resources/Wiki/Video.php index 9d92415eb..61a61f7fe 100644 --- a/app/Filament/Resources/Wiki/Video.php +++ b/app/Filament/Resources/Wiki/Video.php @@ -24,6 +24,9 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Components\TextEntry; +use Filament\Infolists\Infolist; use Filament\Resources\RelationManagers\RelationGroup; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; @@ -45,13 +48,6 @@ class Video extends BaseResource */ protected static ?string $model = VideoModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -88,6 +84,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.videos'); + } + /** * Get the slug (URI key) for the resource. * @@ -174,7 +182,7 @@ public static function form(Form $form): Form TextInput::make(VideoModel::ATTRIBUTE_BASENAME) ->label(__('filament.fields.video.basename.name')) ->hiddenOn(['create', 'edit']), - + TextInput::make(VideoModel::ATTRIBUTE_FILENAME) ->label(__('filament.fields.video.filename.name')) ->hiddenOn(['create', 'edit']), @@ -241,38 +249,15 @@ public static function table(Table $table): Table ->options(VideoSource::asSelectArray()) ->toggleable(), - TextColumn::make(VideoModel::RELATION_AUDIO.'.'.AudioModel::ATTRIBUTE_FILENAME) + TextColumn::make(VideoModel::RELATION_AUDIO . '.' . AudioModel::ATTRIBUTE_FILENAME) ->label(__('filament.resources.singularLabel.audio')) ->visibleOn(['create', 'edit']), - TextColumn::make(VideoModel::ATTRIBUTE_BASENAME) - ->label(__('filament.fields.video.basename.name')) - ->copyable() - ->hidden(), - TextColumn::make(VideoModel::ATTRIBUTE_FILENAME) ->label(__('filament.fields.video.filename.name')) ->sortable() ->copyable() ->toggleable(), - - TextColumn::make(VideoModel::ATTRIBUTE_PATH) - ->label(__('filament.fields.video.path.name')) - ->sortable() - ->copyable() - ->hidden(), - - TextColumn::make(VideoModel::ATTRIBUTE_SIZE) - ->label(__('filament.fields.video.size.name')) - ->sortable() - ->copyable() - ->hidden(), - - TextColumn::make(VideoModel::ATTRIBUTE_MIMETYPE) - ->label(__('filament.fields.video.mimetype.name')) - ->sortable() - ->copyable() - ->hidden(), ]) ->defaultSort(VideoModel::ATTRIBUTE_ID, 'desc') ->filters(static::getFilters()) @@ -281,6 +266,41 @@ public static function table(Table $table): Table ->headerActions(static::getHeaderActions()); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.file_properties')) + ->schema([ + TextEntry::make(VideoModel::ATTRIBUTE_BASENAME) + ->label(__('filament.fields.video.basename.name')), + + TextEntry::make(VideoModel::ATTRIBUTE_FILENAME) + ->label(__('filament.fields.video.filename.name')), + + TextEntry::make(VideoModel::ATTRIBUTE_PATH) + ->label(__('filament.fields.video.path.name')), + + TextEntry::make(VideoModel::ATTRIBUTE_SIZE) + ->label(__('filament.fields.video.size.name')), + + TextEntry::make(VideoModel::ATTRIBUTE_MIMETYPE) + ->label(__('filament.fields.video.mimetype.name')), + ]), + + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the relationships available for the resource. * @@ -337,7 +357,7 @@ public static function getActions(): array ->requiresConfirmation() ->modalWidth(MaxWidth::FourExtraLarge) ->authorize('create', VideoModel::class), - + DeleteVideoAction::make('delete-video') ->label(__('filament.actions.video.delete.name')) ->requiresConfirmation() diff --git a/app/Filament/Resources/Wiki/Video/Script.php b/app/Filament/Resources/Wiki/Video/Script.php index 484dcb1c0..bdfe281ea 100644 --- a/app/Filament/Resources/Wiki/Video/Script.php +++ b/app/Filament/Resources/Wiki/Video/Script.php @@ -16,6 +16,8 @@ use App\Models\Wiki\Video\VideoScript as ScriptModel; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Infolist; use Filament\Support\Enums\MaxWidth; use Filament\Tables\Actions\ActionGroup; use Filament\Tables\Columns\TextColumn; @@ -33,13 +35,6 @@ class Script extends BaseResource */ protected static ?string $model = ScriptModel::class; - /** - * The icon displayed to the resource. - * - * @var string|null - */ - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; - /** * Get the displayable singular label of the resource. * @@ -76,6 +71,18 @@ public static function getNavigationGroup(): string return __('filament.resources.group.wiki'); } + /** + * The icon displayed to the resource. + * + * @return string + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function getNavigationIcon(): string + { + return __('filament.resources.icon.video_scripts'); + } + /** * Get the slug (URI key) for the resource. * @@ -203,6 +210,23 @@ public static function getActions(): array ); } + /** + * Get the infolist available for the resource. + * + * @param Infolist $infolist + * @return Infolist + * + * @noinspection PhpMissingParentCallCommonInspection + */ + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Section::make(__('filament.fields.base.timestamps')) + ->schema(parent::timestamps()), + ]); + } + /** * Get the bulk actions available for the resource. * diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php index 996eb6ff9..ea13399f9 100644 --- a/app/Models/Auth/User.php +++ b/app/Models/Auth/User.php @@ -13,6 +13,7 @@ use App\Models\List\Playlist; use Database\Factories\Auth\UserFactory; use Filament\Models\Contracts\FilamentUser; +use Filament\Models\Contracts\HasAvatar; use Filament\Panel; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -49,7 +50,7 @@ * * @method static UserFactory factory(...$parameters) */ -class User extends Authenticatable implements MustVerifyEmail, Nameable, FilamentUser +class User extends Authenticatable implements MustVerifyEmail, Nameable, FilamentUser, HasAvatar { use Actionable; use HasApiTokens; @@ -190,6 +191,18 @@ public function canAccessPanel(Panel $panel): bool return $this->hasVerifiedEmail() && $this->hasAnyPermission(SpecialPermission::VIEW_FILAMENT->value); } + /** + * Get the filament avatar. + * + * @return string + */ + public function getFilamentAvatarUrl(): string + { + $hash = md5(strtolower(trim($this->email))); + + return 'https://www.gravatar.com/avatar/'.$hash; + } + /** * Get the playlists that belong to the user. * diff --git a/app/Policies/Admin/AnnouncementPolicy.php b/app/Policies/Admin/AnnouncementPolicy.php index 68b9cf220..320380a2b 100644 --- a/app/Policies/Admin/AnnouncementPolicy.php +++ b/app/Policies/Admin/AnnouncementPolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Announcement::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Announcement::class)); + } } diff --git a/app/Policies/Admin/DumpPolicy.php b/app/Policies/Admin/DumpPolicy.php index 5415862db..95ed13716 100644 --- a/app/Policies/Admin/DumpPolicy.php +++ b/app/Policies/Admin/DumpPolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Dump::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Dump::class)); + } } diff --git a/app/Policies/Admin/FeaturePolicy.php b/app/Policies/Admin/FeaturePolicy.php index 3c0c39bac..11e1ed414 100644 --- a/app/Policies/Admin/FeaturePolicy.php +++ b/app/Policies/Admin/FeaturePolicy.php @@ -7,6 +7,7 @@ use App\Enums\Auth\CrudPermission; use App\Models\Admin\Feature; use App\Models\Auth\User; +use Filament\Facades\Filament; use Illuminate\Auth\Access\HandlesAuthorization; use Laravel\Nova\Nova; @@ -42,7 +43,7 @@ public function view(?User $user, Feature $feature): bool { return Nova::whenServing( fn (): bool => $user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)), - fn (): bool => $feature->isNullScope() + fn (): bool => Filament::isServing() ? $user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)) : $feature->isNullScope() ); } diff --git a/app/Policies/Admin/FeaturedThemePolicy.php b/app/Policies/Admin/FeaturedThemePolicy.php index 3f2fcdbdf..ab38bf95c 100644 --- a/app/Policies/Admin/FeaturedThemePolicy.php +++ b/app/Policies/Admin/FeaturedThemePolicy.php @@ -8,6 +8,7 @@ use App\Enums\Auth\ExtendedCrudPermission; use App\Models\Admin\FeaturedTheme; use App\Models\Auth\User; +use Filament\Facades\Filament; use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Support\Facades\Date; use Laravel\Nova\Nova; @@ -44,7 +45,7 @@ public function view(?User $user, FeaturedTheme $featuredtheme): bool { return Nova::whenServing( fn (): bool => $user !== null && $user->can(CrudPermission::VIEW->format(FeaturedTheme::class)), - fn (): bool => $featuredtheme->start_at->isBefore(Date::now()) + fn (): bool => Filament::isServing() ? $user !== null && $user->can(CrudPermission::VIEW->format(FeaturedTheme::class)) : $featuredtheme->start_at->isBefore(Date::now()) ); } @@ -105,4 +106,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(FeaturedTheme::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(FeaturedTheme::class)); + } } diff --git a/app/Policies/Auth/PermissionPolicy.php b/app/Policies/Auth/PermissionPolicy.php index bcbf6cfab..02e951e3d 100644 --- a/app/Policies/Auth/PermissionPolicy.php +++ b/app/Policies/Auth/PermissionPolicy.php @@ -94,6 +94,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Permission::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Permission::class)); + } + /** * Determine whether the user can attach any role to the permission. * diff --git a/app/Policies/Auth/RolePolicy.php b/app/Policies/Auth/RolePolicy.php index 0944f7810..fcf3d49f9 100644 --- a/app/Policies/Auth/RolePolicy.php +++ b/app/Policies/Auth/RolePolicy.php @@ -94,6 +94,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Role::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Role::class)); + } + /** * Determine whether the user can attach any permission to the role. * diff --git a/app/Policies/Document/PagePolicy.php b/app/Policies/Document/PagePolicy.php index d0bf87850..33bc5de1e 100644 --- a/app/Policies/Document/PagePolicy.php +++ b/app/Policies/Document/PagePolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Page::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Page::class)); + } } diff --git a/app/Policies/List/Playlist/PlaylistTrackPolicy.php b/app/Policies/List/Playlist/PlaylistTrackPolicy.php index cfc7838c5..ef7356f23 100644 --- a/app/Policies/List/Playlist/PlaylistTrackPolicy.php +++ b/app/Policies/List/Playlist/PlaylistTrackPolicy.php @@ -10,6 +10,7 @@ use App\Models\Auth\User; use App\Models\List\Playlist; use App\Models\List\Playlist\PlaylistTrack; +use Filament\Facades\Filament; use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Http\Request; use Laravel\Nova\Nova; @@ -32,6 +33,8 @@ public function viewAny(?User $user): bool return Nova::whenServing( fn (): bool => $user !== null && $user->hasRole('Admin'), function (Request $request) use ($user): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); @@ -56,6 +59,8 @@ public function view(?User $user, PlaylistTrack $track): bool return Nova::whenServing( fn (): bool => $user !== null && $user->hasRole('Admin'), function (Request $request) use ($user): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); @@ -77,6 +82,8 @@ public function create(User $user): bool return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), function (Request $request) use ($user): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); @@ -99,6 +106,8 @@ public function update(User $user, PlaylistTrack $track): bool return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), function (Request $request) use ($user, $track): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); @@ -121,6 +130,8 @@ public function delete(User $user, PlaylistTrack $track): bool return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), function (Request $request) use ($user, $track): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); @@ -143,6 +154,8 @@ public function restore(User $user, PlaylistTrack $track): bool return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), function (Request $request) use ($user, $track): bool { + if (Filament::isServing()) return $user !== null && $user->hasRole('Admin'); + /** @var Playlist|null $playlist */ $playlist = $request->route('playlist'); diff --git a/app/Policies/List/PlaylistPolicy.php b/app/Policies/List/PlaylistPolicy.php index 19c50d717..05a1425a7 100644 --- a/app/Policies/List/PlaylistPolicy.php +++ b/app/Policies/List/PlaylistPolicy.php @@ -11,6 +11,7 @@ use App\Models\List\Playlist; use App\Models\Wiki\Image; use App\Pivots\List\PlaylistImage; +use Filament\Facades\Filament; use Illuminate\Auth\Access\HandlesAuthorization; use Laravel\Nova\Nova; @@ -31,7 +32,11 @@ public function viewAny(?User $user): bool { return Nova::whenServing( fn (): bool => $user !== null && $user->hasRole('Admin'), - fn (): bool => $user === null || $user->can(CrudPermission::VIEW->format(Playlist::class)) + function () use ($user): bool { + return Filament::isServing() + ? $user !== null && $user->hasRole('Admin') + : $user === null || $user->can(CrudPermission::VIEW->format(Playlist::class)); + } ); } @@ -62,7 +67,11 @@ public function create(User $user): bool { return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), - fn (): bool => $user->can(CrudPermission::CREATE->format(Playlist::class)) + function () use ($user): bool { + return Filament::isServing() + ? $user->hasRole('Admin') + : $user->can(CrudPermission::CREATE->format(Playlist::class)); + } ); } @@ -77,7 +86,11 @@ public function update(User $user, Playlist $playlist): bool { return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), - fn (): bool => ! $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(CrudPermission::UPDATE->format(Playlist::class)) + function () use ($user, $playlist): bool { + return Filament::isServing() + ? $user->hasRole('Admin') + : ! $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(CrudPermission::UPDATE->format(Playlist::class)); + } ); } @@ -92,7 +105,11 @@ public function delete(User $user, Playlist $playlist): bool { return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), - fn (): bool => ! $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(CrudPermission::DELETE->format(Playlist::class)) + function () use ($user, $playlist): bool { + return Filament::isServing() + ? $user->hasRole('Admin') + : ! $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(CrudPermission::DELETE->format(Playlist::class)); + } ); } @@ -107,7 +124,11 @@ public function restore(User $user, Playlist $playlist): bool { return Nova::whenServing( fn (): bool => $user->hasRole('Admin'), - fn (): bool => $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(ExtendedCrudPermission::RESTORE->format(Playlist::class)) + function () use ($user, $playlist): bool { + return Filament::isServing() + ? $user->hasRole('Admin') + : $playlist->trashed() && $user->getKey() === $playlist->user_id && $user->can(ExtendedCrudPermission::RESTORE->format(Playlist::class)); + } ); } diff --git a/app/Policies/Wiki/Anime/AnimeSynonymPolicy.php b/app/Policies/Wiki/Anime/AnimeSynonymPolicy.php index 0538355e4..00cab935f 100644 --- a/app/Policies/Wiki/Anime/AnimeSynonymPolicy.php +++ b/app/Policies/Wiki/Anime/AnimeSynonymPolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeSynonym::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeSynonym::class)); + } } diff --git a/app/Policies/Wiki/Anime/AnimeThemePolicy.php b/app/Policies/Wiki/Anime/AnimeThemePolicy.php index 3eabe5ff9..43026c6ba 100644 --- a/app/Policies/Wiki/Anime/AnimeThemePolicy.php +++ b/app/Policies/Wiki/Anime/AnimeThemePolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeTheme::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeTheme::class)); + } } diff --git a/app/Policies/Wiki/Anime/Theme/AnimeThemeEntryPolicy.php b/app/Policies/Wiki/Anime/Theme/AnimeThemeEntryPolicy.php index 2ba77a2f7..ff258e4cd 100644 --- a/app/Policies/Wiki/Anime/Theme/AnimeThemeEntryPolicy.php +++ b/app/Policies/Wiki/Anime/Theme/AnimeThemeEntryPolicy.php @@ -106,6 +106,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeThemeEntry::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(AnimeThemeEntry::class)); + } + /** * Determine whether the user can attach any video to the entry. * diff --git a/app/Policies/Wiki/AnimePolicy.php b/app/Policies/Wiki/AnimePolicy.php index b9c6b8371..1944be220 100644 --- a/app/Policies/Wiki/AnimePolicy.php +++ b/app/Policies/Wiki/AnimePolicy.php @@ -110,6 +110,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Anime::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Anime::class)); + } + /** * Determine whether the user can attach any series to the anime. * diff --git a/app/Policies/Wiki/ArtistPolicy.php b/app/Policies/Wiki/ArtistPolicy.php index 4c2e3b2d8..5b3be673b 100644 --- a/app/Policies/Wiki/ArtistPolicy.php +++ b/app/Policies/Wiki/ArtistPolicy.php @@ -106,6 +106,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Artist::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Artist::class)); + } + /** * Determine whether the user can attach any resource to the artist. * diff --git a/app/Policies/Wiki/AudioPolicy.php b/app/Policies/Wiki/AudioPolicy.php index 8e765d3c4..787495ce6 100644 --- a/app/Policies/Wiki/AudioPolicy.php +++ b/app/Policies/Wiki/AudioPolicy.php @@ -104,6 +104,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Audio::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Audio::class)); + } + /** * Determine whether the user can add a video to the audio. * diff --git a/app/Policies/Wiki/ExternalResourcePolicy.php b/app/Policies/Wiki/ExternalResourcePolicy.php index ed2c7f6ca..bdd0f2743 100644 --- a/app/Policies/Wiki/ExternalResourcePolicy.php +++ b/app/Policies/Wiki/ExternalResourcePolicy.php @@ -104,6 +104,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(ExternalResource::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(ExternalResource::class)); + } + /** * Determine whether the user can attach any artist to the resource. * diff --git a/app/Policies/Wiki/ImagePolicy.php b/app/Policies/Wiki/ImagePolicy.php index 5971c3fe7..45b13ff58 100644 --- a/app/Policies/Wiki/ImagePolicy.php +++ b/app/Policies/Wiki/ImagePolicy.php @@ -112,6 +112,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Image::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Image::class)); + } + /** * Determine whether the user can attach any artist to the image. * diff --git a/app/Policies/Wiki/SeriesPolicy.php b/app/Policies/Wiki/SeriesPolicy.php index eb46d0ab2..70196fc31 100644 --- a/app/Policies/Wiki/SeriesPolicy.php +++ b/app/Policies/Wiki/SeriesPolicy.php @@ -106,6 +106,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Series::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Series::class)); + } + /** * Determine whether the user can attach any anime to the series. * diff --git a/app/Policies/Wiki/SongPolicy.php b/app/Policies/Wiki/SongPolicy.php index 0bc449d61..b2cc1f30f 100644 --- a/app/Policies/Wiki/SongPolicy.php +++ b/app/Policies/Wiki/SongPolicy.php @@ -104,6 +104,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Song::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Song::class)); + } + /** * Determine whether the user can add a theme to the song. * diff --git a/app/Policies/Wiki/StudioPolicy.php b/app/Policies/Wiki/StudioPolicy.php index ae407aa17..ddc01eff9 100644 --- a/app/Policies/Wiki/StudioPolicy.php +++ b/app/Policies/Wiki/StudioPolicy.php @@ -108,6 +108,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Studio::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Studio::class)); + } + /** * Determine whether the user can attach any anime to the studio. * diff --git a/app/Policies/Wiki/Video/VideoScriptPolicy.php b/app/Policies/Wiki/Video/VideoScriptPolicy.php index 615cb8b3f..6adba2b77 100644 --- a/app/Policies/Wiki/Video/VideoScriptPolicy.php +++ b/app/Policies/Wiki/Video/VideoScriptPolicy.php @@ -103,4 +103,15 @@ public function forceDelete(User $user): bool { return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(VideoScript::class)); } + + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(VideoScript::class)); + } } diff --git a/app/Policies/Wiki/VideoPolicy.php b/app/Policies/Wiki/VideoPolicy.php index 870a15efc..a5277d87c 100644 --- a/app/Policies/Wiki/VideoPolicy.php +++ b/app/Policies/Wiki/VideoPolicy.php @@ -104,6 +104,17 @@ public function forceDelete(User $user): bool return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Video::class)); } + /** + * Determine whether the user can permanently delete any model. + * + * @param User $user + * @return bool + */ + public function forceDeleteAny(User $user): bool + { + return $user->can(ExtendedCrudPermission::FORCE_DELETE->format(Video::class)); + } + /** * Determine whether the user can attach any entry to a video. * diff --git a/lang/en/filament.php b/lang/en/filament.php index 23b1329f0..5167fe238 100644 --- a/lang/en/filament.php +++ b/lang/en/filament.php @@ -83,6 +83,12 @@ 'base' => [ 'cancelButtonText' => 'Cancel', 'confirmButtonText' => 'Confirm', + 'delete' => 'Delete', + 'detach' => 'Detach', + 'edit' => 'Edit', + 'forcedelete' => 'Force Delete', + 'restore' => 'Restore', + 'view' => 'View', ], 'discord' => [ 'thread' => [ @@ -389,6 +395,14 @@ ], ], ], + 'bulk_actions' => [ + 'base' => [ + 'delete' => 'Delete Selected', + 'detach' => 'Detach Selected', + 'forcedelete' => 'Force Delete Selected', + 'restore' => 'Restore Selected', + ], + ], 'fields' => [ 'anime_synonym' => [ 'text' => [ @@ -686,6 +700,7 @@ ], ], 'user' => [ + 'avatar' => 'Avatar', 'email' => 'Email', 'name' => 'Name', ], @@ -850,6 +865,33 @@ 'list' => 'List', 'wiki' => 'Wiki', ], + 'icon' => [ + 'anime_synonyms' => 'heroicon-o-list-bullet', + 'anime_theme_entries' => 'heroicon-o-list-bullet', + 'anime_themes' => 'heroicon-o-list-bullet', + 'anime' => 'heroicon-o-tv', + 'announcements' => 'heroicon-o-megaphone', + 'artists' => 'heroicon-o-user-circle', + 'audios' => 'heroicon-o-speaker-wave', + 'dumps' => 'heroicon-o-circle-stack', + 'external_resources' => 'heroicon-o-arrow-top-right-on-square', + 'features' => 'heroicon-o-cog-6-tooth', + 'featured_themes' => 'heroicon-o-list-bullet', + 'groups' => '', + 'images' => 'heroicon-o-photo', + 'members' => '', + 'pages' => 'heroicon-o-document-text', + 'permissions' => 'heroicon-o-information-circle', + 'playlist_tracks' => 'heroicon-o-play', + 'playlists' => 'heroicon-o-play', + 'roles' => 'heroicon-o-briefcase', + 'series' => 'heroicon-o-folder', + 'songs' => 'heroicon-o-musical-note', + 'studios' => 'heroicon-o-building-office', + 'users' => 'heroicon-o-users', + 'video_scripts' => 'heroicon-o-document-text', + 'videos' => 'heroicon-o-film', + ], 'label' => [ 'anime_synonyms' => 'Anime Synonyms', 'anime_theme_entries' => 'Anime Theme Entries', @@ -871,7 +913,6 @@ 'playlists' => 'Playlists', 'roles' => 'Roles', 'series' => 'Series', - 'settings' => 'Settings', 'songs' => 'Songs', 'studios' => 'Studios', 'users' => 'Users', @@ -897,7 +938,6 @@ 'playlist' => 'Playlist', 'role' => 'Role', 'series' => 'Series', - 'setting' => 'Setting', 'song' => 'Song', 'studio' => 'Studio', 'user' => 'User',