-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Package
filament/filament
Package Version
v4.3.1
Laravel Version
v12.43.1
Livewire Version
v3.7.3
PHP Version
PHP 8.4.16
Problem description
I have a working project on Filament v3, which I am moving to v4, there is a Purchase model, where people add Quotes. quotes are added by an Add Quote button on Purchase Resource View Page - there is a multi-step Wizard to add quotes.
On v3, it works fine, on v4, the Add Quote button (which is actually a CreateAction) opens the purchase Create page - ignoring model and provided steps method.
I changed it to simple Action and now the form mentioned in schema / steps is being opened, but it is checking for relationships on the current Purchase View model, resulting in error
Button Code on ViewPurchase.php
protected function getHeaderActions(): array
{
return [
EditAction::make(),
Action::make('add_quote_action')
->modal()
->model(Quote::class)
->schema(QuoteForm::formComponents())
->action(function ($data, $record) {
$record->quotes()->create($data);
}),
CreateAction::make('add_quote_create_action')
->modal()
->model(Quote::class)
->schema(QuoteForm::formComponents())
->action(function ($data, $record) {
$record->quotes()->create($data);
})
];
}
}
The Action throws error
LogicException
vendor\filament\forms\src\Components\Select.php:1289
The relationship [vendor] does not exist on the model [App\Models\Purchase].
The relationship is on quote which belongsTo Vendor and Purchase both, Purchase select relation is hidden on ViewPurchase and set when creating, Vendor needs to be selected in the modal
**Create action ** shows Add Quote when I set model(Quote::class), but still it opens the Purchase Create Page URL at: https://filament-v4-create-other-model-via-modal.test/admin/purchases/create?record=1
ignores the modal() method as well.
Expected behavior
Open Form in Modal, allowing creating of Quote from Purchase Page
-- in current code/commit, quote creation code is not there, as the error is occuring before that
-- I will be adding code as well
expected wizard form image from current v3 live deployment - this wizard code is not the reproduce repo, simple text form only
Steps to reproduce
clone repo
composer install
npm install / npm ci
php artisan migrate --seed
https://filament-v4-create-other-model-via-modal.test/admin/purchases/1
[email protected], testuser
Try adding a Quote from Purchase View Page
Add to Quote action button, results in error, trying to find vendor relation on Purchase model.

New Quote Button opens the Create Purchase Page
Reproduction repository (issue will be closed if this is not valid)
https://github.com/zaidpirwani/filament-v4-create-other-model-via-modal
Relevant log output
Metadata
Metadata
Assignees
Labels
Type
Projects
Status