From ae04e6a53955c10d853d2bfbad408658649b951d Mon Sep 17 00:00:00 2001 From: Curtis Delicata Date: Fri, 28 Jun 2024 18:13:04 +0000 Subject: [PATCH] Configure Jetstream classes in providers and separate panels into Admin and App --- .../Resources/ActivationResource.php | 0 .../Pages/CreateActivation.php | 0 .../Pages/EditActivation.php | 0 .../Pages/ListActivations.php | 0 .../Resources/AuthorResource.php | 0 .../AuthorResource/Pages/CreateAuthor.php | 0 .../AuthorResource/Pages/EditAuthor.php | 0 .../AuthorResource/Pages/ListAuthors.php | 0 .../Resources/CommentResource.php | 0 .../CommentResource/Pages/CreateComment.php | 0 .../CommentResource/Pages/EditComment.php | 0 .../CommentResource/Pages/ListComments.php | 0 .../Resources/CompanyResource.php | 0 .../CompanyResource/Pages/CreateCompany.php | 0 .../CompanyResource/Pages/EditCompany.php | 0 .../CompanyResource/Pages/ListCompanies.php | 0 .../Resources/ContentCategoryResource.php | 0 .../Pages/CreateContentCategory.php | 0 .../Pages/EditContentCategory.php | 0 .../Pages/ListContentCategories.php | 0 .../Resources/ContentResource.php | 0 .../ContentResource/Pages/CreateContent.php | 0 .../ContentResource/Pages/EditContent.php | 0 .../ContentResource/Pages/ListContents.php | 0 .../Resources/Resources/PageResource.php | 0 .../{Admin => App}/Resources/TagResource.php | 0 .../Resources/TagResource/Pages/CreateTag.php | 0 .../Resources/TagResource/Pages/EditTag.php | 0 .../Resources/TagResource/Pages/ListTags.php | 0 app/Providers/Filament/AdminPanelProvider.php | 56 +------------------ 30 files changed, 1 insertion(+), 55 deletions(-) rename app/Filament/{Admin => App}/Resources/ActivationResource.php (100%) rename app/Filament/{Admin => App}/Resources/ActivationResource/Pages/CreateActivation.php (100%) rename app/Filament/{Admin => App}/Resources/ActivationResource/Pages/EditActivation.php (100%) rename app/Filament/{Admin => App}/Resources/ActivationResource/Pages/ListActivations.php (100%) rename app/Filament/{Admin => App}/Resources/AuthorResource.php (100%) rename app/Filament/{Admin => App}/Resources/AuthorResource/Pages/CreateAuthor.php (100%) rename app/Filament/{Admin => App}/Resources/AuthorResource/Pages/EditAuthor.php (100%) rename app/Filament/{Admin => App}/Resources/AuthorResource/Pages/ListAuthors.php (100%) rename app/Filament/{Admin => App}/Resources/CommentResource.php (100%) rename app/Filament/{Admin => App}/Resources/CommentResource/Pages/CreateComment.php (100%) rename app/Filament/{Admin => App}/Resources/CommentResource/Pages/EditComment.php (100%) rename app/Filament/{Admin => App}/Resources/CommentResource/Pages/ListComments.php (100%) rename app/Filament/{Admin => App}/Resources/CompanyResource.php (100%) rename app/Filament/{Admin => App}/Resources/CompanyResource/Pages/CreateCompany.php (100%) rename app/Filament/{Admin => App}/Resources/CompanyResource/Pages/EditCompany.php (100%) rename app/Filament/{Admin => App}/Resources/CompanyResource/Pages/ListCompanies.php (100%) rename app/Filament/{Admin => App}/Resources/ContentCategoryResource.php (100%) rename app/Filament/{Admin => App}/Resources/ContentCategoryResource/Pages/CreateContentCategory.php (100%) rename app/Filament/{Admin => App}/Resources/ContentCategoryResource/Pages/EditContentCategory.php (100%) rename app/Filament/{Admin => App}/Resources/ContentCategoryResource/Pages/ListContentCategories.php (100%) rename app/Filament/{Admin => App}/Resources/ContentResource.php (100%) rename app/Filament/{Admin => App}/Resources/ContentResource/Pages/CreateContent.php (100%) rename app/Filament/{Admin => App}/Resources/ContentResource/Pages/EditContent.php (100%) rename app/Filament/{Admin => App}/Resources/ContentResource/Pages/ListContents.php (100%) rename app/Filament/{Admin => App}/Resources/Resources/PageResource.php (100%) rename app/Filament/{Admin => App}/Resources/TagResource.php (100%) rename app/Filament/{Admin => App}/Resources/TagResource/Pages/CreateTag.php (100%) rename app/Filament/{Admin => App}/Resources/TagResource/Pages/EditTag.php (100%) rename app/Filament/{Admin => App}/Resources/TagResource/Pages/ListTags.php (100%) diff --git a/app/Filament/Admin/Resources/ActivationResource.php b/app/Filament/App/Resources/ActivationResource.php similarity index 100% rename from app/Filament/Admin/Resources/ActivationResource.php rename to app/Filament/App/Resources/ActivationResource.php diff --git a/app/Filament/Admin/Resources/ActivationResource/Pages/CreateActivation.php b/app/Filament/App/Resources/ActivationResource/Pages/CreateActivation.php similarity index 100% rename from app/Filament/Admin/Resources/ActivationResource/Pages/CreateActivation.php rename to app/Filament/App/Resources/ActivationResource/Pages/CreateActivation.php diff --git a/app/Filament/Admin/Resources/ActivationResource/Pages/EditActivation.php b/app/Filament/App/Resources/ActivationResource/Pages/EditActivation.php similarity index 100% rename from app/Filament/Admin/Resources/ActivationResource/Pages/EditActivation.php rename to app/Filament/App/Resources/ActivationResource/Pages/EditActivation.php diff --git a/app/Filament/Admin/Resources/ActivationResource/Pages/ListActivations.php b/app/Filament/App/Resources/ActivationResource/Pages/ListActivations.php similarity index 100% rename from app/Filament/Admin/Resources/ActivationResource/Pages/ListActivations.php rename to app/Filament/App/Resources/ActivationResource/Pages/ListActivations.php diff --git a/app/Filament/Admin/Resources/AuthorResource.php b/app/Filament/App/Resources/AuthorResource.php similarity index 100% rename from app/Filament/Admin/Resources/AuthorResource.php rename to app/Filament/App/Resources/AuthorResource.php diff --git a/app/Filament/Admin/Resources/AuthorResource/Pages/CreateAuthor.php b/app/Filament/App/Resources/AuthorResource/Pages/CreateAuthor.php similarity index 100% rename from app/Filament/Admin/Resources/AuthorResource/Pages/CreateAuthor.php rename to app/Filament/App/Resources/AuthorResource/Pages/CreateAuthor.php diff --git a/app/Filament/Admin/Resources/AuthorResource/Pages/EditAuthor.php b/app/Filament/App/Resources/AuthorResource/Pages/EditAuthor.php similarity index 100% rename from app/Filament/Admin/Resources/AuthorResource/Pages/EditAuthor.php rename to app/Filament/App/Resources/AuthorResource/Pages/EditAuthor.php diff --git a/app/Filament/Admin/Resources/AuthorResource/Pages/ListAuthors.php b/app/Filament/App/Resources/AuthorResource/Pages/ListAuthors.php similarity index 100% rename from app/Filament/Admin/Resources/AuthorResource/Pages/ListAuthors.php rename to app/Filament/App/Resources/AuthorResource/Pages/ListAuthors.php diff --git a/app/Filament/Admin/Resources/CommentResource.php b/app/Filament/App/Resources/CommentResource.php similarity index 100% rename from app/Filament/Admin/Resources/CommentResource.php rename to app/Filament/App/Resources/CommentResource.php diff --git a/app/Filament/Admin/Resources/CommentResource/Pages/CreateComment.php b/app/Filament/App/Resources/CommentResource/Pages/CreateComment.php similarity index 100% rename from app/Filament/Admin/Resources/CommentResource/Pages/CreateComment.php rename to app/Filament/App/Resources/CommentResource/Pages/CreateComment.php diff --git a/app/Filament/Admin/Resources/CommentResource/Pages/EditComment.php b/app/Filament/App/Resources/CommentResource/Pages/EditComment.php similarity index 100% rename from app/Filament/Admin/Resources/CommentResource/Pages/EditComment.php rename to app/Filament/App/Resources/CommentResource/Pages/EditComment.php diff --git a/app/Filament/Admin/Resources/CommentResource/Pages/ListComments.php b/app/Filament/App/Resources/CommentResource/Pages/ListComments.php similarity index 100% rename from app/Filament/Admin/Resources/CommentResource/Pages/ListComments.php rename to app/Filament/App/Resources/CommentResource/Pages/ListComments.php diff --git a/app/Filament/Admin/Resources/CompanyResource.php b/app/Filament/App/Resources/CompanyResource.php similarity index 100% rename from app/Filament/Admin/Resources/CompanyResource.php rename to app/Filament/App/Resources/CompanyResource.php diff --git a/app/Filament/Admin/Resources/CompanyResource/Pages/CreateCompany.php b/app/Filament/App/Resources/CompanyResource/Pages/CreateCompany.php similarity index 100% rename from app/Filament/Admin/Resources/CompanyResource/Pages/CreateCompany.php rename to app/Filament/App/Resources/CompanyResource/Pages/CreateCompany.php diff --git a/app/Filament/Admin/Resources/CompanyResource/Pages/EditCompany.php b/app/Filament/App/Resources/CompanyResource/Pages/EditCompany.php similarity index 100% rename from app/Filament/Admin/Resources/CompanyResource/Pages/EditCompany.php rename to app/Filament/App/Resources/CompanyResource/Pages/EditCompany.php diff --git a/app/Filament/Admin/Resources/CompanyResource/Pages/ListCompanies.php b/app/Filament/App/Resources/CompanyResource/Pages/ListCompanies.php similarity index 100% rename from app/Filament/Admin/Resources/CompanyResource/Pages/ListCompanies.php rename to app/Filament/App/Resources/CompanyResource/Pages/ListCompanies.php diff --git a/app/Filament/Admin/Resources/ContentCategoryResource.php b/app/Filament/App/Resources/ContentCategoryResource.php similarity index 100% rename from app/Filament/Admin/Resources/ContentCategoryResource.php rename to app/Filament/App/Resources/ContentCategoryResource.php diff --git a/app/Filament/Admin/Resources/ContentCategoryResource/Pages/CreateContentCategory.php b/app/Filament/App/Resources/ContentCategoryResource/Pages/CreateContentCategory.php similarity index 100% rename from app/Filament/Admin/Resources/ContentCategoryResource/Pages/CreateContentCategory.php rename to app/Filament/App/Resources/ContentCategoryResource/Pages/CreateContentCategory.php diff --git a/app/Filament/Admin/Resources/ContentCategoryResource/Pages/EditContentCategory.php b/app/Filament/App/Resources/ContentCategoryResource/Pages/EditContentCategory.php similarity index 100% rename from app/Filament/Admin/Resources/ContentCategoryResource/Pages/EditContentCategory.php rename to app/Filament/App/Resources/ContentCategoryResource/Pages/EditContentCategory.php diff --git a/app/Filament/Admin/Resources/ContentCategoryResource/Pages/ListContentCategories.php b/app/Filament/App/Resources/ContentCategoryResource/Pages/ListContentCategories.php similarity index 100% rename from app/Filament/Admin/Resources/ContentCategoryResource/Pages/ListContentCategories.php rename to app/Filament/App/Resources/ContentCategoryResource/Pages/ListContentCategories.php diff --git a/app/Filament/Admin/Resources/ContentResource.php b/app/Filament/App/Resources/ContentResource.php similarity index 100% rename from app/Filament/Admin/Resources/ContentResource.php rename to app/Filament/App/Resources/ContentResource.php diff --git a/app/Filament/Admin/Resources/ContentResource/Pages/CreateContent.php b/app/Filament/App/Resources/ContentResource/Pages/CreateContent.php similarity index 100% rename from app/Filament/Admin/Resources/ContentResource/Pages/CreateContent.php rename to app/Filament/App/Resources/ContentResource/Pages/CreateContent.php diff --git a/app/Filament/Admin/Resources/ContentResource/Pages/EditContent.php b/app/Filament/App/Resources/ContentResource/Pages/EditContent.php similarity index 100% rename from app/Filament/Admin/Resources/ContentResource/Pages/EditContent.php rename to app/Filament/App/Resources/ContentResource/Pages/EditContent.php diff --git a/app/Filament/Admin/Resources/ContentResource/Pages/ListContents.php b/app/Filament/App/Resources/ContentResource/Pages/ListContents.php similarity index 100% rename from app/Filament/Admin/Resources/ContentResource/Pages/ListContents.php rename to app/Filament/App/Resources/ContentResource/Pages/ListContents.php diff --git a/app/Filament/Admin/Resources/Resources/PageResource.php b/app/Filament/App/Resources/Resources/PageResource.php similarity index 100% rename from app/Filament/Admin/Resources/Resources/PageResource.php rename to app/Filament/App/Resources/Resources/PageResource.php diff --git a/app/Filament/Admin/Resources/TagResource.php b/app/Filament/App/Resources/TagResource.php similarity index 100% rename from app/Filament/Admin/Resources/TagResource.php rename to app/Filament/App/Resources/TagResource.php diff --git a/app/Filament/Admin/Resources/TagResource/Pages/CreateTag.php b/app/Filament/App/Resources/TagResource/Pages/CreateTag.php similarity index 100% rename from app/Filament/Admin/Resources/TagResource/Pages/CreateTag.php rename to app/Filament/App/Resources/TagResource/Pages/CreateTag.php diff --git a/app/Filament/Admin/Resources/TagResource/Pages/EditTag.php b/app/Filament/App/Resources/TagResource/Pages/EditTag.php similarity index 100% rename from app/Filament/Admin/Resources/TagResource/Pages/EditTag.php rename to app/Filament/App/Resources/TagResource/Pages/EditTag.php diff --git a/app/Filament/Admin/Resources/TagResource/Pages/ListTags.php b/app/Filament/App/Resources/TagResource/Pages/ListTags.php similarity index 100% rename from app/Filament/Admin/Resources/TagResource/Pages/ListTags.php rename to app/Filament/App/Resources/TagResource/Pages/ListTags.php diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index ae5660e..da1c2d9 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -3,7 +3,6 @@ namespace App\Providers\Filament; use App\Filament\Admin\Pages; -use App\Filament\Admin\Pages\EditProfile; use App\Http\Middleware\TeamsPermission; use App\Listeners\CreatePersonalTeam; use App\Listeners\SwitchTeam; @@ -43,26 +42,16 @@ public function panel(Panel $panel): Panel ->id('admin') ->path('admin') ->login([AuthenticatedSessionController::class, 'create']) - ->registration([RegisteredUserController::class, 'create']) ->passwordReset() ->emailVerification() ->viteTheme('resources/css/Filament/Admin/theme.css') ->colors([ 'primary' => Color::Gray, ]) - ->userMenuItems([ - MenuItem::make() - ->label('Profile') - ->icon('heroicon-o-user-circle') - ->url(fn () => $this->shouldRegisterMenuItem() - ? url(EditProfile::getUrl()) - : url($panel->getPath())), - ]) ->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources') ->discoverPages(in: app_path('Filament/Admin/Pages'), for: 'App\\Filament\\Admin\\Pages') ->pages([ - FilamentPage\Dashboard::class, - Pages\EditProfile::class, + Filament\Page\Dashboard::class, ]) ->discoverWidgets(in: app_path('Filament/Admin/Widgets/Home'), for: 'App\\Filament\\Admin\\Widgets\\Home') ->widgets([ @@ -82,39 +71,11 @@ public function panel(Panel $panel): Panel ]) ->authMiddleware([ Authenticate::class, - TeamsPermission::class, ]) ->plugins([ \BezhanSalleh\FilamentShield\FilamentShieldPlugin::make() ]); - if (Features::hasApiFeatures()) { - $panel->userMenuItems([ - MenuItem::make() - ->label('API Tokens') - ->icon('heroicon-o-key') - ->url(fn () => $this->shouldRegisterMenuItem() - ? url(Pages\ApiTokenManagerPage::getUrl()) - : url($panel->getPath())), - ]); - } - - if (Features::hasTeamFeatures()) { - $panel - ->tenant(Team::class, ownershipRelationship: 'team') - ->tenantRegistration(Pages\CreateTeam::class) - ->tenantProfile(Pages\EditTeam::class) - ->userMenuItems([ - MenuItem::make() - ->label('Team Settings') - ->icon('heroicon-o-cog-6-tooth') - ->url(fn () => $this->shouldRegisterMenuItem() - ? url(Pages\EditTeam::getUrl()) - : url($panel->getPath())), - ]); - } - - return $panel; } public function boot() @@ -129,21 +90,6 @@ public function boot() */ Jetstream::$registersRoutes = false; - /** - * Listen and create personal team for new accounts. - */ - Event::listen( - Registered::class, - CreatePersonalTeam::class, - ); - - /** - * Listen and switch team if tenant was changed. - */ - Event::listen( - TenantSet::class, - SwitchTeam::class, - ); } public function shouldRegisterMenuItem(): bool