Error Filament\Forms\Components\Select::isOptionDisabled(): Argument #2 ($label) must be of type str
Hi. I have a select field in my form builder that uses
user
relationship but it throws this error:
My code:
8 Replies
Maybe try adding a label instead like this:
Because Filament will try to use
model_id
as a string and label for it. In a case such as if you were only using make('model')
it would probably work but that depends on your column name...It didn't work
What does the Table Column look like for it?
The column name is
model_id
and the relationship is like this:
Actually, when I change that to ->relationship('user', 'id')
is works. but in that case it shows me the id of the users but I want their names
Oh, I think I found the reason. I had some records in user table which their name column was NULL and after I deleted them, it's working but in some cases I might have NULL in the name column because that's nullable so what can I do now?Hm well it all just depends on a lot of things, there could be a small mistake somewhere... You can take a look at this as an example..
https://github.com/andrewdwallo/erpsaas/blob/master/app/Filament/Pages/CompanyWidgets/Companies.php
And you can look at the way my database is set up and the way the models are set up..
GitHub
erpsaas/Companies.php at master · andrewdwallo/erpsaas
Contribute to andrewdwallo/erpsaas development by creating an account on GitHub.
Thats really all I can do for you...
Those are setup as Filament widgets but the same elements should apply...
Thanks 😃
Also for your database if you want a column to be nullable then use nullable don’t use null, and if it is null don’t put anything