ardenthq/nova-table-metrics
最新稳定版本:1.1.0
Composer 安装命令:
composer require ardenthq/nova-table-metrics
包简介
Advanced table metrics for Laravel Nova.
README 文档
README
A custom card allowing you to add Table Metrics with a Date Period filter
Installation
composer require ardenthq/nova-table-metrics
Usage
Creating a Table component
class GreatestShows extends Table { public function title() : string { return 'Greatest TV shows'; } public function heading() : string { return 'Title'; } public function detailHeading() : string { return 'Views'; } public function defaultPeriod() : ?Period { return Period::Day; } /** * @return Collection<int, TableRow> */ public function items(?Period $period) : Collection { return collect([ TableRow::make('Silicon Valley', '42,184') ->url('https://www.youtube.com/watch?v=dQw4w9WgXcQ') ->openInNewTab(), // ]); } }
Disable date filters
To disable date filters, override the hasPeriodSelector method on the Table component:
class GreatestShows extends Table { public function title() : string { return 'Greatest TV shows'; } public function heading() : string { return 'Title'; } public function detailHeading() : string { return 'Views'; } public function defaultPeriod() : ?Period { return null; } /** * @return Collection<int, TableRow> */ public function items(?Period $period) : Collection { return collect([ TableRow::make('Silicon Valley', '42,184') ->url('https://www.youtube.com/watch?v=dQw4w9WgXcQ') ->openInNewTab(), // ]); } public function hasPeriodSelector() : bool { return false; } }
Registering a Table
In your Nova dashboard, register a table by adding it to the cards method:
class Main extends Dashboard { public function name() { return 'Dashboard'; } public function cards() { return [ // ... GreatestShows::make()->width('1/3'), ]; } }
Development
- Run
yarn nova:installandyarn installto install all the necessary dependencies for compiling the view components - Run
yarn run dev(oryarn run watch) while making changes to the components in your local environment - If you modify Vue components, ensure to compile for production before making a PR
Compile for production
- Run
yarn nova:installandyarn installto install all the necessary dependencies for compiling the view components. - Run
yarn run production.
Analyze the code with phpstan
composer analyse
Refactor the code with php rector
composer refactor
Format the code with php-cs-fixer
composer format
Security
If you discover a security vulnerability within this package, please send an e-mail to security@ardenthq.com. All security vulnerabilities will be promptly addressed.
Credits
This project exists thanks to all the people who contribute.
License
统计信息
- 总下载量: 12.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-29


