Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Nov 21, 2023
1 parent 3b08a20 commit a18e140
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Filament/Forms/Components/ParentSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ protected function setUp(): void
parent::setUp();

// dddx($this->getModel());
$this->options(fn (ParentSelect $component) =>
// return Navigation::pluck('name', $component->getOptionValueProperty());
['a' => 'a', 'b' => 'b']);
$this->options(static fn(ParentSelect $component): array => ['a' => 'a', 'b' => 'b']);
}

public function getOptionValueProperty(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function sortNavigation(string $targetStatePath, array $targetItemsStateP

$items[$uuid] = $item;
}

$model = $this->getResource()::getModel();
/*
dddx([
Expand Down Expand Up @@ -153,13 +154,13 @@ protected function getHeaderActions(): array
// dddx($this->getFormSchema());
$formSchema = $this->getResource()::form(Form::make($this))->getComponents();
$formSchema = collect($formSchema)
->keyBy(fn ($item) => $item->getName())->except('sons')
->keyBy(static fn($item) => $item->getName())->except('sons')
->toArray();

// $formSchema=$this->getFormSchema();
return [
Action::make('item')
->mountUsing(function (ComponentContainer $form) {
->mountUsing(function (ComponentContainer $form): void {
if (! $this->mountedItem) {
return;
}
Expand All @@ -168,7 +169,7 @@ protected function getHeaderActions(): array
})
->form($formSchema)
->modalWidth('xl')
->action(function (array $data, $record) {
->action(function (array $data, $record): void {
/*
dddx([
'record'=>$record,
Expand All @@ -185,11 +186,13 @@ protected function getHeaderActions(): array

return;
}

if ($this->mountedChildTarget) { // ADD CHILD
$this->storeChildItem($record, $data);

return;
}

// CREATE

$this->storeItem($record, $data);
Expand Down

0 comments on commit a18e140

Please sign in to comment.