Set state for enum
How can I get the selected value for a select column when the date is filled from an enum?
the enum data returns;
18 Replies
There is no difference then setting other state, right? In this case it’s 1 or 2
I didn't run the migrations 🤣
well, anyow, another question on this matterç
I have something like this;
But the state can't be set? I can't access $record in
state()
?
Or how am I supposed to do this? 😅Use
->relationship()
instead of afterStateUpdatedYou can't do a
$model->relation->relation
?
Call to undefined method App\Models\VendingMachine::sellingPoint.zone()
Doing; Forms\Components\Select::make('sellingPoint.zone')
->relationship('sellingPoint.zone', 'name'),
it should be this; ->state($this->getRecord()->sellingPoint->zone->id)
but then you get Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
I thought nested relation were supported. You could wrap this in a Layout field with the sellingPoint relation and then just the select inside
huh
I don't really understand what you mean here @Dennis Koch
But then I get something like this;
okay, not when I do it as a grid
BUT
How the heck would this work
Does this work?
Yes and no
When I save it,
Add fillable property [zone] to allow mass assignment on [App\Models\SellingPoint].
but that's on a relation 🤔sounds like a sane error to me?
Yes and no... it should use the zone_id, not the while zone object because when I add it to the mass assignment (which we should not) you see the query and it's something like;
oh god
I'm an idiot
This worked 🙈
Thanks a lot for pointing the fact that the docs should be read in full 😅
LOVE FILAMENT
(btw, we started using filament in all of our projects (+- 150)
150 projects?! 😅
looking forward to those sponsorships coming in from you/your happy clients! 😉
converting all our projects to filament if they have a shit or non admin area