Download the PHP package formfeed-uk/nova-subfield-dependson without Composer
On this page you can find all versions of the php package formfeed-uk/nova-subfield-dependson. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download formfeed-uk/nova-subfield-dependson
More information about formfeed-uk/nova-subfield-dependson
Files in formfeed-uk/nova-subfield-dependson
Package nova-subfield-dependson
Short Description Functionality to allow fields which are contained within other fields to use Nova DependsOn
License MIT
Informations about the package nova-subfield-dependson
Nova Subfield DependsOn
This Laravel Nova package includes an interface and middleware to allow fields that contain subfields (such as Dependable Panel, or Flexible Content) to allow those subfields to use the dependsOn
functionality within Laravel Nova 4.
As long as all fields that contain subfields implement the interface methods any subfield could be nested within any field to any depth.
Requirements
php: >=8.0
laravel/nova: ^4.0
Installation
1) Install the package in to a Laravel app that uses Nova via composer:
Usage
Simply implement the included interface onto any Field you wish to allow subfields to use the dependsOn functionality
hasSubFields
This method should return a boolean value to indicate whether the current instance of your field has subfields that require the dependsOn functionality.
getSubfields
This method should return a FieldCollection
of the subfields that require the dependsOn functionality
afterDependsOnSync
This method is run after any dependsOn sync where additional logic may be required. This may simply return $this;
where no additional logic is required.
Known Issues
Due to how Nova's DependantComponentKey works If a field uses the same Class, Component, and Attribute as another subfield within the same request this could cause a collision, where the wrong field is found. An upcoming release will include a macro for Laravel\Nova\Fields\Field
to allow you to set your own DependantComponentKey method.