Introduce filament

This commit is contained in:
xiaomlove
2022-06-27 01:39:01 +08:00
parent aae45835ee
commit 1aca20070d
92 changed files with 3535 additions and 83 deletions
+3
View File
@@ -49,6 +49,9 @@ return [
'nexus' => [
'driver' => 'nexus-cookie',
],
'nexus-web' => [
'driver' => 'nexus-web',
],
],
/*
+8
View File
@@ -142,6 +142,14 @@ return [
'database' => (int)env('REDIS_CACHE_DB', '1'),
],
'session' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => (int)env('REDIS_PORT', '6379'),
'database' => 10,
],
],
];
+293
View File
@@ -0,0 +1,293 @@
<?php
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Http\Middleware\MirrorConfigToSubpackages;
use Filament\Pages;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
return [
/*
|--------------------------------------------------------------------------
| Filament Path
|--------------------------------------------------------------------------
|
| The default is `admin` but you can change it to whatever works best and
| doesn't conflict with the routing in your application.
|
*/
'path' => env('FILAMENT_PATH', 'filament'),
/*
|--------------------------------------------------------------------------
| Filament Core Path
|--------------------------------------------------------------------------
|
| This is the path which Filament will use to load it's core routes and assets.
| You may change it if it conflicts with your other routes.
|
*/
'core_path' => env('FILAMENT_CORE_PATH', 'filament'),
/*
|--------------------------------------------------------------------------
| 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'),
/*
|--------------------------------------------------------------------------
| Homepage URL
|--------------------------------------------------------------------------
|
| This is the URL that Filament will redirect the user to when they click
| on the sidebar's header.
|
*/
'home_url' => '/',
/*
|--------------------------------------------------------------------------
| Brand Name
|--------------------------------------------------------------------------
|
| This will be displayed on the login page and in the sidebar's header.
|
*/
'brand' => 'NexusPHP',
/*
|--------------------------------------------------------------------------
| Auth
|--------------------------------------------------------------------------
|
| This is the configuration that Filament will use to handle authentication
| into the admin panel.
|
*/
'auth' => [
// 'guard' => env('FILAMENT_AUTH_GUARD', 'web'),
'guard' => env('FILAMENT_AUTH_GUARD', 'nexus-web'),
'pages' => [
'login' => \Filament\Http\Livewire\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,
\App\Filament\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,
],
],
/*
|--------------------------------------------------------------------------
| Livewire
|--------------------------------------------------------------------------
|
| This is the namespace and directory that Filament will automatically
| register Livewire components inside.
|
*/
'livewire' => [
'namespace' => 'App\\Filament',
'path' => app_path('Filament'),
],
/*
|--------------------------------------------------------------------------
| Dark mode
|--------------------------------------------------------------------------
|
| By enabling this feature, your users are able to select between a light
| and dark appearance for the admin panel, or let their system decide.
|
*/
'dark_mode' => false,
/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
|
| This is the configuration for the general layout of the admin panel.
|
| You may configure the max content width from `xl` to `7xl`, or `full`
| for no max width.
|
*/
'layout' => [
'forms' => [
'actions' => [
'alignment' => 'left',
],
'have_inline_labels' => false,
],
'footer' => [
'should_show_logo' => false,
],
'max_content_width' => null,
'notifications' => [
'vertical_alignment' => 'center',
'alignment' => 'center',
],
'sidebar' => [
'is_collapsible_on_desktop' => true,
'groups' => [
'are_collapsible' => true,
],
'width' => null,
],
],
/*
|--------------------------------------------------------------------------
| Favicon
|--------------------------------------------------------------------------
|
| This is the path to the favicon used for pages in the admin panel.
|
*/
'favicon' => null,
/*
|--------------------------------------------------------------------------
| 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'),
/*
|--------------------------------------------------------------------------
| Google Fonts
|--------------------------------------------------------------------------
|
| This is the URL for Google Fonts that should be loaded. You may use any
| font, or set to `null` to prevent any Google Fonts from loading.
|
| When using a custom font, you should also set the font family in your
| custom theme's `tailwind.config.js` file.
|
*/
'google_fonts' => 'https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap',
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| You may customise the middleware stack that Filament uses to handle
| requests.
|
*/
'middleware' => [
'auth' => [
\App\Http\Middleware\Filament::class,
],
'base' => [
// EncryptCookies::class,
\App\Http\Middleware\EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
// AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DispatchServingFilamentEvent::class,
MirrorConfigToSubpackages::class,
\App\Http\Middleware\Locale::class,
],
],
];
+68
View File
@@ -0,0 +1,68 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Components
|--------------------------------------------------------------------------
|
| These are the settings that Filament will use to control the appearance
| and behaviour of form components.
|
*/
'components' => [
'actions' => [
'modal' => [
'actions' => [
'alignment' => 'left',
],
],
],
'date_time_picker' => [
'first_day_of_week' => 1, // 0 to 7 are accepted values, with Monday as 1 and Sunday as 7 or 0.
'display_formats' => [
'date' => 'Y-m-d',
'date_time' => 'Y-m-d H:i:s',
'date_time_with_seconds' => 'Y-m-d H:i:s',
'time' => 'H:i',
'time_with_seconds' => 'H:i:s',
],
],
],
/*
|--------------------------------------------------------------------------
| 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('FORMS_FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------
| Dark mode
|--------------------------------------------------------------------------
|
| By enabling this feature, your users are able to select between a light
| and dark appearance for forms, via Tailwind's Dark Mode feature.
|
| https://tailwindcss.com/docs/dark-mode
|
*/
'dark_mode' => false,
];
+159
View File
@@ -0,0 +1,159 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Class Namespace
|--------------------------------------------------------------------------
|
| This value sets the root namespace for Livewire component classes in
| your application. This value affects component auto-discovery and
| any Livewire file helper commands, like `artisan make:livewire`.
|
| After changing this item, run: `php artisan livewire:discover`.
|
*/
'class_namespace' => 'App\\Http\\Livewire',
/*
|--------------------------------------------------------------------------
| View Path
|--------------------------------------------------------------------------
|
| This value sets the path for Livewire component views. This affects
| file manipulation helper commands like `artisan make:livewire`.
|
*/
'view_path' => resource_path('views/livewire'),
/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
| The default layout view that will be used when rendering a component via
| Route::get('/some-endpoint', SomeComponent::class);. In this case the
| the view returned by SomeComponent will be wrapped in "layouts.app"
|
*/
'layout' => 'layouts.app',
/*
|--------------------------------------------------------------------------
| Livewire Assets URL
|--------------------------------------------------------------------------
|
| This value sets the path to Livewire JavaScript assets, for cases where
| your app's domain root is not the correct path. By default, Livewire
| will load its JavaScript assets from the app's "relative root".
|
| Examples: "/assets", "myurl.com/app".
|
*/
'asset_url' => null,
/*
|--------------------------------------------------------------------------
| Livewire App URL
|--------------------------------------------------------------------------
|
| This value should be used if livewire assets are served from CDN.
| Livewire will communicate with an app through this url.
|
| Examples: "https://my-app.com", "myurl.com/app".
|
*/
'app_url' => null,
/*
|--------------------------------------------------------------------------
| Livewire Endpoint Middleware Group
|--------------------------------------------------------------------------
|
| This value sets the middleware group that will be applied to the main
| Livewire "message" endpoint (the endpoint that gets hit everytime
| a Livewire component updates). It is set to "web" by default.
|
*/
'middleware_group' => 'auth.filament',
// 'middleware_group' => 'web',
/*
|--------------------------------------------------------------------------
| Livewire Temporary File Uploads Endpoint Configuration
|--------------------------------------------------------------------------
|
| Livewire handles file uploads by storing uploads in a temporary directory
| before the file is validated and stored permanently. All file uploads
| are directed to a global endpoint for temporary storage. The config
| items below are used for customizing the way the endpoint works.
|
*/
'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' Default: 'default'
'rules' => null, // Example: ['file', 'mimes:png,jpg'] Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' Default 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs.
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload gets invalidated.
],
/*
|--------------------------------------------------------------------------
| Manifest File Path
|--------------------------------------------------------------------------
|
| This value sets the path to the Livewire manifest file.
| The default should work for most cases (which is
| "<app_root>/bootstrap/cache/livewire-components.php"), but for specific
| cases like when hosting on Laravel Vapor, it could be set to a different value.
|
| Example: for Laravel Vapor, it would be "/tmp/storage/bootstrap/cache/livewire-components.php".
|
*/
'manifest_path' => null,
/*
|--------------------------------------------------------------------------
| Back Button Cache
|--------------------------------------------------------------------------
|
| This value determines whether the back button cache will be used on pages
| that contain Livewire. By disabling back button cache, it ensures that
| the back button shows the correct state of components, instead of
| potentially stale, cached data.
|
| Setting it to "false" (default) will disable back button cache.
|
*/
'back_button_cache' => false,
/*
|--------------------------------------------------------------------------
| Render On Redirect
|--------------------------------------------------------------------------
|
| This value determines whether Livewire will render before it's redirected
| or not. Setting it to "false" (default) will mean the render method is
| skipped when redirecting. And "true" will mean the render method is
| run before redirecting. Browsers bfcache can store a potentially
| stale view if render is skipped on redirect.
|
*/
'render_on_redirect' => false,
];
+4 -2
View File
@@ -18,7 +18,8 @@ return [
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
// 'driver' => env('SESSION_DRIVER', 'file'),
'driver' => 'redis',
/*
|--------------------------------------------------------------------------
@@ -72,7 +73,8 @@ return [
|
*/
'connection' => env('SESSION_CONNECTION', null),
// 'connection' => env('SESSION_CONNECTION', null),
'connection' => 'session',
/*
|--------------------------------------------------------------------------
+80
View File
@@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Date / Time Formatting
|--------------------------------------------------------------------------
|
| These are the formats that Filament will use to display dates and times
| by default.
|
*/
'date_format' => 'Y-m-d',
'date_time_format' => 'Y-m-d H:i',
'time_format' => 'H:i:s',
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| This is the storage disk Filament will use to find media. You may use any
| of the disks defined in the `config/filesystems.php`.
|
*/
'default_filesystem_disk' => env('TABLES_FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------
| Dark mode
|--------------------------------------------------------------------------
|
| By enabling this feature, your users are able to select between a light
| and dark appearance for tables, via Tailwind's Dark Mode feature.
|
| https://tailwindcss.com/docs/dark-mode
|
*/
'dark_mode' => false,
/*
|--------------------------------------------------------------------------
| Pagination
|--------------------------------------------------------------------------
|
| This is the configuration for the pagination of tables.
|
*/
'pagination' => [
'default_records_per_page' => 10,
],
/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
|
| This is the configuration for the general layout of tables.
|
*/
'layout' => [
'actions' => [
'cell' => [
'alignment' => 'right',
],
'modal' => [
'actions' => [
'alignment' => 'left',
],
],
],
],
];