From ee2785652357c69dcc38ab98a1cf338d30f9d1f4 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Thu, 16 Dec 2021 15:44:54 +0000 Subject: [PATCH] wip --- .env.example | 2 +- app/Filament/Pages/Auth/Login.php | 19 ++ .../Resources/Blog/AuthorResource.php | 4 +- .../AuthorResource/Pages/CreateAuthor.php | 4 +- .../Blog/AuthorResource/Pages/EditAuthor.php | 4 +- .../Blog/AuthorResource/Pages/ListAuthors.php | 4 +- .../Resources/Blog/CategoryResource.php | 4 +- .../CategoryResource/Pages/CreateCategory.php | 4 +- .../CategoryResource/Pages/EditCategory.php | 4 +- .../CategoryResource/Pages/ListCategories.php | 4 +- app/Filament/Resources/Blog/PostResource.php | 4 +- .../Blog/PostResource/Pages/CreatePost.php | 4 +- .../Blog/PostResource/Pages/EditPost.php | 4 +- .../Blog/PostResource/Pages/ListPosts.php | 4 +- app/Filament/Resources/Shop/BrandResource.php | 4 +- .../Shop/BrandResource/Pages/CreateBrand.php | 4 +- .../Shop/BrandResource/Pages/EditBrand.php | 4 +- .../Shop/BrandResource/Pages/ListBrands.php | 4 +- .../Resources/Shop/CategoryResource.php | 4 +- .../CategoryResource/Pages/CreateCategory.php | 4 +- .../CategoryResource/Pages/EditCategory.php | 4 +- .../CategoryResource/Pages/ListCategories.php | 4 +- .../Resources/Shop/CustomerResource.php | 4 +- .../CustomerResource/Pages/CreateCustomer.php | 4 +- .../CustomerResource/Pages/EditCustomer.php | 4 +- .../CustomerResource/Pages/ListCustomers.php | 4 +- .../Resources/Shop/DiscountResource.php | 4 +- .../DiscountResource/Pages/CreateDiscount.php | 4 +- .../DiscountResource/Pages/EditDiscount.php | 4 +- .../DiscountResource/Pages/ListDiscounts.php | 4 +- app/Filament/Resources/Shop/OrderResource.php | 4 +- .../Shop/OrderResource/Pages/CreateOrder.php | 4 +- .../Shop/OrderResource/Pages/EditOrder.php | 4 +- .../Shop/OrderResource/Pages/ListOrders.php | 4 +- .../Resources/Shop/ProductResource.php | 4 +- .../ProductResource/Pages/CreateProduct.php | 4 +- .../ProductResource/Pages/EditProduct.php | 4 +- .../ProductResource/Pages/ListProducts.php | 4 +- .../Resources/Shop/ReviewResource.php | 4 +- .../ReviewResource/Pages/CreateReview.php | 4 +- .../Shop/ReviewResource/Pages/EditReview.php | 4 +- .../Shop/ReviewResource/Pages/ListReviews.php | 4 +- app/Forms/Components/AddressForm.php | 4 +- app/Models/Address.php | 4 +- app/Models/Blog/Author.php | 4 +- app/Models/Blog/Category.php | 4 +- app/Models/Blog/Post.php | 4 +- app/Models/Shop/Brand.php | 4 +- app/Models/Shop/Category.php | 4 +- app/Models/Shop/Customer.php | 4 +- app/Models/Shop/Discount.php | 4 +- app/Models/Shop/Order.php | 4 +- app/Models/Shop/OrderItem.php | 4 +- app/Models/Shop/Product.php | 4 +- app/Models/Shop/Review.php | 4 +- app/Models/User.php | 4 +- app/Providers/AppServiceProvider.php | 10 +- app/Providers/AuthServiceProvider.php | 4 +- app/Providers/BroadcastServiceProvider.php | 4 +- app/Providers/EventServiceProvider.php | 4 +- app/Providers/RouteServiceProvider.php | 4 +- config/filament.php | 185 ++++++++++++++++++ database/seeders/DatabaseSeeder.php | 2 +- routes/web.php | 17 -- 64 files changed, 270 insertions(+), 197 deletions(-) create mode 100644 app/Filament/Pages/Auth/Login.php create mode 100644 config/filament.php diff --git a/.env.example b/.env.example index 2c4742f21..c58d71a1c 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -APP_NAME=Laravel +APP_NAME="Filament Demo" APP_ENV=local APP_KEY= APP_DEBUG=true diff --git a/app/Filament/Pages/Auth/Login.php b/app/Filament/Pages/Auth/Login.php new file mode 100644 index 000000000..feb198d2a --- /dev/null +++ b/app/Filament/Pages/Auth/Login.php @@ -0,0 +1,19 @@ +form->fill([ + 'email' => 'admin@filamentadmin.com', + 'password' => 'password', + 'remember' => true, + ]); + } +} diff --git a/app/Filament/Resources/Blog/AuthorResource.php b/app/Filament/Resources/Blog/AuthorResource.php index 64e7266e8..1aa3745f4 100644 --- a/app/Filament/Resources/Blog/AuthorResource.php +++ b/app/Filament/Resources/Blog/AuthorResource.php @@ -1,7 +1,5 @@ env('FILAMENT_PATH', '/'), + + /* + |-------------------------------------------------------------------------- + | Filament Domain + |-------------------------------------------------------------------------- + | + | You may change the domain where Filament should be active. If the domain + | is empty, all domains will be valid. + | + */ + + 'domain' => env('FILAMENT_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Auth + |-------------------------------------------------------------------------- + | + | This is the configuration that Filament will use to handle authentication + | into the admin panel. + | + */ + + 'auth' => [ + 'guard' => env('FILAMENT_AUTH_GUARD', 'web'), + 'pages' => [ + 'login' => \App\Filament\Pages\Auth\Login::class, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Pages + |-------------------------------------------------------------------------- + | + | This is the namespace and directory that Filament will automatically + | register pages from. You may also register pages here. + | + */ + + 'pages' => [ + 'namespace' => 'App\\Filament\\Pages', + 'path' => app_path('Filament/Pages'), + 'register' => [ + Pages\Dashboard::class, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Resources + |-------------------------------------------------------------------------- + | + | This is the namespace and directory that Filament will automatically + | register resources from. You may also register resources here. + | + */ + + 'resources' => [ + 'namespace' => 'App\\Filament\\Resources', + 'path' => app_path('Filament/Resources'), + 'register' => [], + ], + + /* + |-------------------------------------------------------------------------- + | Widgets + |-------------------------------------------------------------------------- + | + | This is the namespace and directory that Filament will automatically + | register dashboard widgets from. You may also register widgets here. + | + */ + + 'widgets' => [ + 'namespace' => 'App\\Filament\\Widgets', + 'path' => app_path('Filament/Widgets'), + 'register' => [ + Widgets\AccountWidget::class, + Widgets\FilamentInfoWidget::class, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Layout + |-------------------------------------------------------------------------- + | + | This is the configuration for the general appearance of the admin panel. + | + | You may configure the max content width from `xl` to `7xl`, or `full` + | for no max width. + | + */ + + 'layout' => [ + 'max_content_width' => null, + 'forms' => [ + 'actions' => [ + 'alignment' => 'left', + ], + ], + ], + + /* + |-------------------------------------------------------------------------- + | Default Avatar Provider + |-------------------------------------------------------------------------- + | + | This is the service that will be used to retrieve default avatars if one + | has not been uploaded. + | + */ + + 'default_avatar_provider' => \Filament\AvatarProviders\UiAvatarsProvider::class, + + /* + |-------------------------------------------------------------------------- + | Default Filesystem Disk + |-------------------------------------------------------------------------- + | + | This is the storage disk Filament will use to put media. You may use any + | of the disks defined in the `config/filesystems.php`. + | + */ + + 'default_filesystem_disk' => env('FILAMENT_FILESYSTEM_DRIVER', 'public'), + + /* + |-------------------------------------------------------------------------- + | Middleware + |-------------------------------------------------------------------------- + | + | You may customise the middleware stack that Filament uses to handle + | requests. + | + */ + + 'middleware' => [ + 'auth' => [ + Authenticate::class, + ], + 'base' => [ + EncryptCookies::class, + AddQueuedCookiesToResponse::class, + StartSession::class, + AuthenticateSession::class, + ShareErrorsFromSession::class, + VerifyCsrfToken::class, + SubstituteBindings::class, + DispatchServingFilamentEvent::class, + MirrorConfigToSubpackages::class, + ], + ], + +]; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 67c209b59..5b6970d1f 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -24,7 +24,7 @@ public function run(): void { // Admin User::factory()->create([ - 'name' => 'Filament Admin', + 'name' => 'Demo User', 'email' => 'admin@filamentadmin.com', ]); diff --git a/routes/web.php b/routes/web.php index b13039731..b3d9bbc7f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,18 +1 @@