diff --git a/README.md b/README.md index ab4b855..7c5e5e1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # BelongsTo Field with Dependency +## Cosa ho cambiato +- introdotta modifica corretta https://github.com/orlyapps/nova-belongsto-depend/issues/96 +- aggiunto quarto parametro `$parentResource` per gestire i casi in cui la risorsa Nova non ha lo stesso nome del modello Laravel. + [![Latest Version on Packagist](https://img.shields.io/packagist/v/orlyapps/nova-belongsto-depend.svg?style=flat-square)](https://packagist.org/packages/Orlyapps/nova-belongsto-depend) [![Total Downloads](https://img.shields.io/packagist/dt/orlyapps/nova-belongsto-depend.svg?style=flat-square)](https://packagist.org/packages/Orlyapps/nova-belongsto-depend) diff --git a/src/NovaBelongsToDepend.php b/src/NovaBelongsToDepend.php index bce2fe2..7603203 100644 --- a/src/NovaBelongsToDepend.php +++ b/src/NovaBelongsToDepend.php @@ -43,7 +43,7 @@ class NovaBelongsToDepend extends BelongsTo */ public $component = 'nova-belongsto-depend'; - public function __construct($name, $attribute = null, $resource = null) + public function __construct($name, $attribute = null, $resource = null, $parentResource = null) { $resource = $resource ?? ResourceRelationshipGuesser::guessResource($name); parent::__construct($name, $attribute, $resource); @@ -54,6 +54,7 @@ public function __construct($name, $attribute = null, $resource = null) $this->optionResolveCallback = function () { return []; }; + $this->setResourceParentClass($parentResource); } public function placeholder($placeholder)