formfeed-uk/nova-resource-cards 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

formfeed-uk/nova-resource-cards

最新稳定版本:1.1.0

Composer 安装命令:

composer require formfeed-uk/nova-resource-cards

包简介

A Laravel Nova package to show cards on all CRUD pages.

README 文档

README

This Laravel Nova package adds the functionality to add Resource Cards at the top of pages.

I consider this package feature complete, however I am open to feature requests and pull requests, if there's something you'd like to see feel free to submit an issue.

Requirements

  • php: >=7.4
  • laravel/nova: ^4.0

Features

This package wraps the following Laravel Nova pages and adds the ability to display Resource Cards above them:

  • Index
  • Detail
  • Create
  • Update
  • Attach
  • Update Attached
  • Replicate
  • Lens
  • Dashboard

As the package is wrapping the pages, it should be fairly robust with regards to Nova Updates.

This package also includes more fine grained control over the pages the cards are displayed on, following the same logic as is used for Fields:

  • showOnIndex
  • showOnDetail
  • showOnCreating
  • showOnUpdating
  • showOnPreview
  • showOnAttach
  • showOnReplicate
  • showOnLens
  • showOnDashboard
  • hideFromIndex
  • hideFromDetail
  • hideFromDashboard
  • hideFromLens
  • hideWhenCreating
  • hideWhenUpdating
  • hideWhenAttaching
  • hideWhenReplicating
  • onlyOnIndex
  • onlyOnDetail
  • onlyOnForms (Now includes Attach and Replicate)
  • onlyOnLens
  • onlyOnDashboard
  • exceptOnForms (Now includes Attach and Replicate)

Cards should extend the included ResourceCard class rather than the standard class, but otherwise can be used like regular cards.

Installation

Install the package in to a Laravel app that uses Nova via composer:

composer require formfeed-uk/nova-resource-cards

Usage

General

  1. Create a card according to the Nova Documentation (or use an existing card if you wish to convert it to ResourceCards).

  2. Update your Card to extend ResourceCard instead of Card:

// MyResourceCard.php ... use Formfeed\ResourceCards\ResourceCard; class MyResourceCard extends ResourceCard { ... }
  1. Then simply include it like a normal card within your resource:
// MyNovaResource.php use App\MyResourceCard; ... class MyNovaResource extends Resource { ... public function cards(NovaRequest $request) { return [ MyResourceCard::make($request) ]; } ... }

Optionally chain visibility and authorisations:

 public function cards(NovaRequest $request) { return [ MyResourceCard::make($request) ->onlyOnForms() ->canSee(function ($request) { return $request->user()->role === "admin"; }), ]; }

It's that simple!

Available parameters

There are a number of parameters available to your card, depending on the page the card is currently on. These parameters are available on the request object as query parameters.

Note: Just because these parameters are available doesn't mean they will be populated for any given request.

Index:

  • resourceName
  • display: "index"

Detail:

  • resourceName
  • resourceId
  • display: "detail"

Create:

  • resourceName
  • viaResource
  • viaResourceId
  • viaRelationship
  • display: "create"

Update:

  • resourceName
  • resourceId
  • viaResource
  • viaResourceId
  • viaRelationship
  • display: "update"

Replicate:

  • resourceName
  • resourceId
  • viaResource
  • viaResourceId
  • viaRelationship
  • display: "replicate"

Attach:

  • resourceName
  • resourceId
  • viaResource
  • viaResourceId
  • viaRelationship
  • parentResource
  • polymorphic
  • formUniqueId
  • relatedResourceName
  • display: "attach"

Update Attached:

  • resourceName
  • resourceId
  • viaResource
  • viaResourceId
  • viaRelationship
  • parentResource
  • polymorphic
  • formUniqueId:
  • relatedResourceName
  • relatedResourceId
  • viaPivotId
  • display: "updateAttached"

Lens:

  • resourceName
  • lens
  • display: "lens

Dashboard:

  • resourceName: Dashboard Name
  • display: "dashboard"

License

Nova Resource Cards is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 69.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固