songs2serve/nova-lens-card

此包已废弃,不再维护。未建议替代包。

使用现有的Lenses将卡片添加到Laravel Nova 3仪表板。

v0.1.0 2020-10-09 20:46 UTC

This package is auto-updated.

Last update: 2024-08-22 09:58:28 UTC


README

将Laravel Nova 3的lenses转换为摘要卡片。

安装

composer require songs2serve/nova-lens-card

使用

在Nova仪表板上添加卡片

namespace App\Providers;

use App\Models\Song;
use Songs2Serve\NovaLensCard\LensCard;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    protected function cards()
    {
        return [
            new LensCard(new MyLens(), Song::class),
        ];
    }
}

在资源概览中添加卡片

namespace App\Nova;

use Songs2Serve\NovaLensCard\LensCard;

class Song extends Resource
{
    protected function cards()
    {
        return [
            new LensCard(new MyLens()),
        ];
    }
}

可以通过调用 limit() 方法自定义记录数量。