the-3labs-team/nova-github-cards

Nova Metrics 与 GitHub Commits 集成

v1.0.1 2023-08-07 09:39 UTC

This package is auto-updated.

Last update: 2024-08-29 23:03:50 UTC


README

Logo Nova Github Cards by The3LabsTeam

Latest Version on Packagist Fix PHP code style issues PHPStan Maintainability License Mit Total Downloads

Nova Github Cards

通过无缝集成 GitHub 项目卡片到您的仪表板中,增强您的 Laravel Nova 体验。这个强大的包让您能够轻松地在 Nova 仪表板中显示 GitHub 的重要统计数据、问题、提交以及其他项目信息。

演示

Demo Nova Github Cards by The3LabsTeam

安装

您可以通过 composer 安装此包

composer require the-3labs-team/nova-github-cards

您可以使用以下命令发布配置文件

php artisan vendor:publish

并选择: The3LabsTeam\NovaGithubCards\NovaGithubCardsServiceProvider

这是已发布配置文件的内容

<?php

return [
    'vendor' => 'YOUR-VENDOR',
    'repository' => 'YOUR-REPO-NAME',
    'branch' => 'main',
    'per_page' => 5,
    'cache_ttl' => 0, //in seconds

    'icons' => [
        'error' => [
            'icon' => 'x-circle',
            'iconClass' => 'text-red-500',
        ],
        'success' => [
            'icon' => 'check-circle',
            'iconClass' => 'text-green-500',
        ],
    ],
];

注意:此包使用 Laravel GitHub,因此您需要在您的 config/github.php 文件中进行配置。

使用方法

您可以在 cards 方法中将您的卡片添加到仪表板中,例如在 Dashboard\Main

use \The3LabsTeam\NovaGithubCards\LatestCommitsTable;
use \The3LabsTeam\NovaGithubCards\LatestIssuesTable;
...

(new LatestCommitsTable()
(new LatestIssuesTable()

您也可以像以下这样为每个卡片覆盖配置

use \The3LabsTeam\NovaGithubCards\LatestCommitsTable;
...

(new LatestCommitsTable(
    name: 'The name of the card (string)', 
    vendor: 'The name of your vendor (string)', 
    repository: 'The name of your repo (string)', 
    branch: 'The name of your branch (string)', 
    perPage: 'Total of results (int)', 
    cache: 'The cache in seconds (int)')
 )