Skip to content

Commit

Permalink
aggiunto quarto parametro per gestione risorsa nova con nome diverso …
Browse files Browse the repository at this point in the history
…da modello
  • Loading branch information
davide-cattani committed Nov 8, 2021
1 parent d4f613a commit 7568352
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
3 changes: 2 additions & 1 deletion src/NovaBelongsToDepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -54,6 +54,7 @@ public function __construct($name, $attribute = null, $resource = null)
$this->optionResolveCallback = function () {
return [];
};
$this->setResourceParentClass($parentResource);
}

public function placeholder($placeholder)
Expand Down

0 comments on commit 7568352

Please sign in to comment.