From b8a596a2a6831c187de50aa301c76379b9f9ea40 Mon Sep 17 00:00:00 2001 From: Adam Weston Date: Wed, 15 Mar 2023 14:22:01 -0400 Subject: [PATCH] Feat: add includes and excludes to config --- README.md | 21 +++++++++++++++++++-- composer.json | 2 +- config/overlook.php | 10 ++++++++++ resources/dist/overlook.css | 2 +- resources/lang/en/overlook.php | 5 ----- resources/views/widget.blade.php | 13 +++++-------- src/Overlook.php | 21 ++++++++++++++++++--- src/OverlookServiceProvider.php | 2 +- 8 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 config/overlook.php delete mode 100644 resources/lang/en/overlook.php diff --git a/README.md b/README.md index e377664..dbe35ae 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,27 @@ You can install the package via composer: composer require awcodes/overlook ``` -Optionally, you can publish the views using +## Usage + +By default, Overlook will display any resource registered with Filament, while still honoring the `canViewAny` policy. This can be undesired and also slow down the dashboard. To prevent this behavior publish the config file with: ```bash -php artisan vendor:publish --tag="overlook-views" +php artisan vendor:publish --tag="overlook-config" +``` + +Inside the config you will have options to either "include" or "exclude" resources from being displayed. + +```php +return [ + 'includes' => [ + App\Filament\Resources\Blog\AuthorResource::class, + App\Filament\Resources\Blog\CategoryResource::class, + App\Filament\Resources\Blog\PostResource::class, + ], + 'excludes' => [ +// App\Filament\Resources\Blog\AuthorResource::class, + ], +]; ``` ## Changelog diff --git a/composer.json b/composer.json index e54390b..66b784d 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "filament/filament": "^2.0", "spatie/laravel-package-tools": "^1.13.5" }, diff --git a/config/overlook.php b/config/overlook.php new file mode 100644 index 0000000..77b1ee4 --- /dev/null +++ b/config/overlook.php @@ -0,0 +1,10 @@ + [ + // App\Filament\Resources\Blog\AuthorResource::class, + ], + 'excludes' => [ + // App\Filament\Resources\Blog\AuthorResource::class, + ], +]; diff --git a/resources/dist/overlook.css b/resources/dist/overlook.css index 815fa98..24e5993 100644 --- a/resources/dist/overlook.css +++ b/resources/dist/overlook.css @@ -1 +1 @@ -.bottom-4{bottom:1rem}.right-4{right:1rem}.top-8{top:2rem}.h-24{height:6rem}.w-auto{width:auto}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-gray-100{--tw-gradient-from:#f3f4f6;--tw-gradient-to:#f3f4f600;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-white{--tw-gradient-to:#fff0;--tw-gradient-stops:var(--tw-gradient-from),#fff,var(--tw-gradient-to)}.to-white{--tw-gradient-to:#fff}.opacity-20{opacity:.2}.focus\:ring-2:focus,.hover\:ring-2:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.group:hover .group-hover\:-rotate-12{--tw-rotate:-12deg}.group:hover .group-hover\:-rotate-12,.group:hover .group-hover\:scale-110{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1}.group:hover .group-hover\:opacity-40{opacity:.4}.dark .dark\:from-gray-900{--tw-gradient-from:#111827;--tw-gradient-to:#11182700;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.dark .dark\:via-gray-800{--tw-gradient-to:#1f293700;--tw-gradient-stops:var(--tw-gradient-from),#1f2937,var(--tw-gradient-to)}.dark .dark\:to-gray-800{--tw-gradient-to:#1f2937}.dark .dark\:opacity-20{opacity:.2}.dark .group:hover .dark\:group-hover\:opacity-80{opacity:.8} \ No newline at end of file +.bottom-4{bottom:1rem}.right-4{right:1rem}.top-8{top:2rem}.-my-8{margin-top:-2rem;margin-bottom:-2rem}.h-24{height:6rem}.w-auto{width:auto}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-gray-100{--tw-gradient-from:#f3f4f6;--tw-gradient-to:#f3f4f600;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-white{--tw-gradient-to:#fff0;--tw-gradient-stops:var(--tw-gradient-from),#fff,var(--tw-gradient-to)}.to-white{--tw-gradient-to:#fff}.opacity-20{opacity:.2}.focus\:ring-2:focus,.hover\:ring-2:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.group:hover .group-hover\:-rotate-12{--tw-rotate:-12deg}.group:hover .group-hover\:-rotate-12,.group:hover .group-hover\:scale-110{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1}.group:hover .group-hover\:opacity-40{opacity:.4}.dark .dark\:from-gray-900{--tw-gradient-from:#111827;--tw-gradient-to:#11182700;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.dark .dark\:via-gray-800{--tw-gradient-to:#1f293700;--tw-gradient-stops:var(--tw-gradient-from),#1f2937,var(--tw-gradient-to)}.dark .dark\:to-gray-800{--tw-gradient-to:#1f2937}.dark .dark\:opacity-20{opacity:.2}.dark .group:hover .dark\:group-hover\:opacity-80{opacity:.8} \ No newline at end of file diff --git a/resources/lang/en/overlook.php b/resources/lang/en/overlook.php deleted file mode 100644 index fcd60ce..0000000 --- a/resources/lang/en/overlook.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Overview' -]; diff --git a/resources/views/widget.blade.php b/resources/views/widget.blade.php index 72b44cb..fbad481 100644 --- a/resources/views/widget.blade.php +++ b/resources/views/widget.blade.php @@ -1,16 +1,11 @@ - + ! $data])> @if($data) -

{{ __('overlook::overlook.heading') }}

- -