Download the PHP package daniel-de-wit/nova-single-record-resource without Composer
On this page you can find all versions of the php package daniel-de-wit/nova-single-record-resource. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daniel-de-wit/nova-single-record-resource
More information about daniel-de-wit/nova-single-record-resource
Files in daniel-de-wit/nova-single-record-resource
Package nova-single-record-resource
Short Description Laravel Nova Single Record Resource. Shows a link in the navigation bar directly to the only record of the resource
License MIT
Homepage https://github.com/daniel-de-wit/nova-single-record-resource
Informations about the package nova-single-record-resource
Laravel Nova: Single Record Resource
Adds the ability to create a navigation link directly to the detail page of a resource. Useful for models that will contain only a single record.
Prerequisites
Installation
Modify app/Nova/Resource.php
to implement SingleRecordResourceInterface
and the SupportSingleRecordNavigationLinks
trait:
Publish assets:
Update
When updating it is important to republish the assets, like so:
Uninstallation
Remove from composer
Remove SupportSingleRecordNavigationLinks
trait from your Nova Resources
Remove the customized navigation template
Usage
Place the following method on models that have only a single record.
Optionally override the resource identifier.
How it works
Laravel Nova has the ability to override the Blade template used to render the navigation sidebar.
The template is copied from Nova version v1.2.0 and altered with a few lines to support linking a resource directly to the detail view.
When publishing vendor assets with the tag nova-views
the template will be placed in the project resources/views/vendor/nova/resources
folder.