Download the PHP package lupennat/nova-nested-many without Composer

On this page you can find all versions of the php package lupennat/nova-nested-many. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nova-nested-many

  1. Requirements
  2. Installation
  3. Usage
  4. HasNestedMany Field
    1. DependsOn
    2. Propagate
    3. Default Children
    4. Additional options
    5. Hooks
  5. Nestable Resource
    1. Nestable Title
    2. Nestable Custom Validation
    3. Nestable Authorization
    4. Nestable Actions
      1. Nestable Basic Actions
      2. Nestable Soft Delete Action
      3. Nestable Custom Actions
      4. Difference With Nova Actions
      5. Nested Object
  6. Recursivity
  7. Changelog
  8. Credits

Requirements

Installation

NOVA PACKAGE
<4.29.5 1.x
>4.29.6 2.x

Usage

Register Trait HasNestedResource globally on Resources.

Use HasManyNested Field like HasMany

HasManyNested is visible by deafult on DetailPage, UpdatePage and CreatePage. HasManyNested is not available on IndexPage.

Implements contract Nestable and use trait HasNested for every related model that will be used with HasNestedMany.

HasNestedMany Field

Depends On

HasNestedMany Field support Nova dependsOn.

Propagate

HasNestedMany Field can propagate parent field value to related resource.

On related resource propagated fields can be retrieved through getNestedPropagated method on Request

Default Children

You can use defaultChildren method to generate a default set of related resource when children are empty.

defaultChildren works only on Create Page.

if you want to overwrite existing children you can use

Additional options

function description default
->collapsedChildrenByDefault() Collapse Children on Panel View false
->useTabs(bool = true) switch display mode to tabs instead of panels false
->active(int = 0) set default active item by index 0
->activeTitle(string) set default active item by title null
->canChangeViewType(bool = true) enable switch view type button false
->hideFields(array<string>) Hide fields on related resource []
->lock(bool = true) Disable Add/Remove buttons for related resource false
->min(int = null) Set Min children null
->max(int = null) Set Max children null

Hooks

You can specify callbacks before and after HasNestedMany fill the database.

Nestable Resource

Resource trait HasNestedResource, provide new functionality related to Nested.

Nestable Title

Both panel and tab views, use nestedTitle method to retrieve the title of the resource.

if method not found it will fallback to original nova resource title

Nestable Custom Validation

Field validation on nestable resources are automatically managed by NestedMany, for each validation error the attribute key is reprocessed and mapped to show feedback to the user in the specific field of the resource generating the error.

When validation is done by adding errors in the validator (e.g., using the afterValidation method), HasManyNested is unable to intercept and remap these errors. On related resource the correct prefix to prepend to the error attribute can be retrieved through getNestedValidationKeyPrefix method on Request.

Nestable Authorization

Nested Many will use laravel nova resource authorizations for create/update/delete. You can define different policies only for Nested Many within 3 new methods

Nestable Actions

You can define Nested Actions to manipulate related content through the server.\

Nested Actions can keep the modal open after action is run through the property $keepOpened or the method keepOpened().

Nestable Basic actions

By Default NestedMany has 3 Basic actions NestedBasicAddAction, NestedBasicDeleteAction, NestedBasicRestoreAction, and it is possible to customize them through 3 methods on resource.

Nestable Soft Delete Action

NestedDeleteAction automatically support softDelete logic (is not a real elouquent softDelete), to enable softdelete/restore logic you need to set protected $nestedHasSoftDelete = true on the related model.

Nestable Custom actions

Nested actions may be generated using the nested-many:action Artisan command. By default, all actions are placed in the app/Nova/NestedActions directory:

You may generate a destructive action by passing the --destructive option:

Nested Actions have a lot in common with Nova Actions, the main difference is that handle method should always return a collection of NestedObject.

You can generate new NestedObject with method $this->getNewNested().

To learn how to define Nova actions, let's look at an example. In this example, we'll define an action that will duplicate a post:

You can register custom NestedActions within your resource throught the method nestedActions

Nested Object

When using NestedActions, all Eloquent models are wrapped by default in the Nested class that extends Laravel Fluent class.\ All Model attributes are replicated on Nested attributes, that way you can modify attributes values directly to the Nested object.

It expose convinient methods to manipulate object without executing queries against the database.

function description return
->delete() Delete/SoftDelete item self
->restore() Restore item self
->active(bool = true) Set item as active self
->isStored() Detected if item is stored on database bool
->isDeleted() Detect if item is SoftDeleted bool
->hasSoftDelete() Detect if item support SoftDelete bool
->getKeyName() Get Eloquent Original keyName string
->toModel() Convert current item to Original Eloquent Model Model

When toModel is called, Nested class apply changes on current object to Original Eloquent Model if Mutators are registered, they will be executed.

Every change executed on Nested Object will not be stored on database until the user click the Create/Update button on the Parent Form Page.

Recursivity

HasManyNested supports recursivity however, it is important to keep in mind that the deletion of a "parent" resource is not recursive to its "children".

Ex. parent resource -> nested resourceA -> nested resourceB

by deleting a nested resource A the nested resources B are not automatically deleted from the database.

You can solve this problem by directly using observers for the delete event on eloquent models.

Nestable Objects with Recursivity

Recursive HasManyNested relations, are available within the children collection of NestedActions, relations are array of Nested Object. You can generate new relation NestedObject with method $this->getNewNested('relationName').


Credits

NestedForm field is based on original Nova Nested Form.


All versions of nova-nested-many with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
laravel/nova Version >=4.29.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lupennat/nova-nested-many contains the following files

Loading the files please wait ....