Skip to content

Commit b938468

Browse files
authored
added support for ebess/advanced-nova-media-library and fixed generell plugin behaviour (#5)
1 parent 0c9c600 commit b938468

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

readme.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# nova 4 dependency container
22

3-
A Laravel Nova 4 form container for grouping fields that depend on other field values. Dependencies can be set on any
4-
field type or value.
3+
A Laravel Nova 4 form container for grouping fields that depend on other field values.
4+
Dependencies can be set on any field type or value.
5+
6+
Features:
7+
8+
- working form validation inside unlimited nested containers
9+
- support of ebess/advanced-nova-media-library
510

611
This plugin is based on [epartment/nova-dependency-container](https://github.com/epartment/nova-dependency-container)
712
and only supports **Nova 4.x** and **PHP 8.x**.

src/DependencyContainer.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,20 @@ public function resolve($resource, $attribute = null)
263263
*/
264264
public function fillInto(NovaRequest $request, $model, $attribute, $requestAttribute = null)
265265
{
266+
$callbacks = [];
267+
266268
foreach ($this->meta['fields'] as $field) {
267-
$field->fill($request, $model);
269+
/** @var Field $field */
270+
$callbacks[] = $field->fill($request, $model);
268271
}
272+
273+
return function () use ($callbacks) {
274+
foreach ($callbacks as $callback) {
275+
if (is_callable($callback)) {
276+
call_user_func($callback);
277+
}
278+
}
279+
};
269280
}
270281

271282
/**

0 commit comments

Comments
 (0)