Download the PHP package formfeed-uk/nova-resource-cards without Composer
On this page you can find all versions of the php package formfeed-uk/nova-resource-cards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download formfeed-uk/nova-resource-cards
More information about formfeed-uk/nova-resource-cards
Files in formfeed-uk/nova-resource-cards
Package nova-resource-cards
Short Description A Laravel Nova package to show cards on all CRUD pages.
License MIT
Homepage https://github.com/formfeed-uk/nova-resource-cards
Informations about the package nova-resource-cards
Nova Resource Cards
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:
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:
3) Then simply include it like a normal card within your resource:
Optionally chain visibility and authorisations:
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.