F
Filament11mo ago
max_dev

Before createNewEntry ask for a related entry first

I want to create a function which opens a modal before the CreateAction of a Model in order to select a Customer first, before i can create the Booking. So i have an db column called 'customer_id' and it should be filled by the User BEFORE starting the creation process, because otherwise i get an error due to the depenant information can't be called, because the 'customer_id' field is empty The relevant code for the error:
Placeholder::make('company')
->label('Anschrift')
->content(fn (Booking $record): HtmlString => new HtmlString($record->customer->company . '<br /> ' . $record->customer->street . ' ' . $record->customer->housenumber . ' <br /> ' . $record->customer->plz . ' ' . $record->customer->city . ' <br /> ' . $record->customer->country) ?? 0),
Placeholder::make('company')
->label('Anschrift')
->content(fn (Booking $record): HtmlString => new HtmlString($record->customer->company . '<br /> ' . $record->customer->street . ' ' . $record->customer->housenumber . ' <br /> ' . $record->customer->plz . ' ' . $record->customer->city . ' <br /> ' . $record->customer->country) ?? 0),
App\Filament\Resources\BookingResource::App\Filament\Resources{closure}(): Argument #1 ($record) must be of type App\Models\Booking, null given, called in /var/www/html/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server