定制 ardenthq/nova-table-metrics 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Run yarn nova:install and yarn install to install all the necessary dependencies for compiling the view components
  2. Run yarn run dev (or yarn run watch) while making changes to the components in your local environment
  3. If you modify Vue components, ensure to compile for production before making a PR

Compile for production

  1. Run yarn nova:install and yarn install to install all the necessary dependencies for compiling the view components.
  2. 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

MIT © ArdentHQ

统计信息

  • 总下载量: 12.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固