awcodes/overlook
Composer 安装命令:
composer require awcodes/overlook
包简介
A Filament plugin that adds an app overview widget to your admin panel.
README 文档
README
A Filament plugin that adds an app overview widget to your admin panel.
Compatibility
| Package Version | Filament Version |
|---|---|
| 1.x | 2.x |
| 2.x | 3.x |
| 3.x | 4.x |
| 4.x | 5.x |
Installation
You can install the package via composer:
composer require awcodes/overlook
Important
If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.
After setting up a custom theme add the plugin's views to your theme css file.
@source '../../../../vendor/awcodes/overlook/resources/**/*.blade.php';
Usage
Add the plugin and widget to your panel provider. You may use the sort and columns methods on the plugin to change the widget order and number of columns the widget will use to display its items.
use Awcodes\Overlook\OverlookPlugin; use Awcodes\Overlook\Widgets\OverlookWidget; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->sort(2) ->columns([ 'default' => 1, 'sm' => 2, 'md' => 3, 'lg' => 4, 'xl' => 5, '2xl' => null, ]), ]) ->widgets([ OverlookWidget::class, ]); }
Including and Excluding Items
By default, the widget will display all resources registered with Filament. You can use either the includes or excludes methods on the plugin to specify which resources to include or exclude.
These methods should not be used together
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->includes([ \App\Filament\Resources\Shop\ProductResource::class, \App\Filament\Resources\Shop\OrderResource::class, ]), ]); }
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->excludes([ \App\Filament\Resources\Shop\ProductResource::class, \App\Filament\Resources\Shop\OrderResource::class, ]), ]); }
Abbreviated Counts
You can disable abbreviated counts by passing false the abbreviateCount method on the plugin.
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->abbreviateCount(false), ]); }
Tooltips
When using abbreviated counts a tooltip will show on hover with the non abbreviated count. You can disable them by passing false the tooltips method on the plugin.
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->tooltips(false), ]); }
Excluding Soft Deleted Records
If your models use soft deletes, you can exclude trashed records from the count with the withoutTrashed method on the plugin.
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->withoutTrashed(), ]); }
Sorting the Items
By default, the items will be sorted in the order they are registered with Filament or as provided in the includes method. You can change this to sort them alphabetically with the alphabetical method on the plugin.
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->alphabetical(), ]); }
Customizing the Widget
By default, the overlook widget uses the getEloquentQuery() method of the Filament Resource, but you can customize the query by implementing the CustomizeOverlookWidget interface on the Filament Resource. The trait HandlesOverlookWidgetCustomization predefines existing customization that can be overriden on the resource class.
use Awcodes\Overlook\Contracts\CustomizeOverlookWidget; use Awcodes\Overlook\Concerns\HandlesOverlookWidgetCustomization; class UserResource extends Resource implements CustomizeOverlookWidget { use HandlesOverlookWidgetCustomization; }
Customize Widget Query
Override the getOverlookWidgetQuery() method to customize the query for the Overlook Widget. This method takes in the existing eloquent query as a parameter that can be used to make further customization.
use Illuminate\Database\Eloquent\Builder; public static function getOverlookWidgetQuery(Builder $query): Builder { return $query->where('status','=','PENDING'); }
Customize Widget Title
Override the getOverlookWidgetTitle() method to customize the title of the widget
public static function getOverlookWidgetTitle(): string { return 'Pending Users'; }
Customize Widget Icon
By default, the icon will be loaded from the resource but you can override it by passing using the icons modifier on the plugin and passing it an array of icon names and resource names.
use Awcodes\Overlook\OverlookPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OverlookPlugin::make() ->icons([ 'heroicon-o-heart' => \App\Filament\Resources\Shop\ProductResource::class, 'heroicon-o-newspaper' => \App\Filament\Resources\Shop\OrderResource::class, ]), ]); }
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
awcodes/overlook 适用场景与选型建议
awcodes/overlook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 193.62k 次下载、GitHub Stars 达 189, 最近一次更新时间为 2023 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「laravel」 「filament」 「awcodes」 「overlook」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 awcodes/overlook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 awcodes/overlook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 awcodes/overlook 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Plugin for YOURLS. Default tools to use in some laemmi plugins
Alfabank REST API integration
Database-driven onboarding for Filament: progress checklists and guided spotlight tours, translatable to any locale.
Allows polling user for event dates and times.
Support swipe touch gestures to navigate in paginated lists and on Tidypics image pages.
统计信息
- 总下载量: 193.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 190
- 点击次数: 32
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-15