Skip to content

Commit

Permalink
Merge pull request #21 from awcodes/fix/relationships
Browse files Browse the repository at this point in the history
Fix: bug in relationship fields
  • Loading branch information
awcodes authored Nov 4, 2022
2 parents 62a8d62 + 8c967a6 commit e535238
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Http/Livewire/QuickCreateMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace FilamentQuickCreate\Http\Livewire;

use Filament\Forms\ComponentContainer;
use Filament\Pages\Actions\CreateAction;
use Filament\Pages\Page;
use Filament\Support\Exceptions\Cancel;
Expand Down Expand Up @@ -144,6 +145,25 @@ public function mountAction(string $name)
]);
}

public function getMountedActionForm(): ?ComponentContainer
{
$action = $this->getMountedAction();

if (! $action) {
return null;
}

if ((! $this->isCachingForms) && $this->hasCachedForm('mountedActionForm')) {
return $this->getCachedForm('mountedActionForm');
}

return $this->makeForm()
->schema($action->getFormSchema())
->statePath('mountedActionData')
->model($action->getModel())
->context($this->mountedAction);
}

public function getFilamentResources(): array
{
$resources = collect(QuickCreateFacade::getResources())
Expand Down

0 comments on commit e535238

Please sign in to comment.