F
Filamentβ€’16mo ago
N. Jacobsen

Additional parameter for model missing when creating the user.

I'm trying to add a user to a organization in a tenant setup. I get this error I have this in my form:
return $form
->schema([
Forms\Components\Select::make('country_id')
->relationship('country', 'name'),
Forms\Components\TextInput::make('name')
->required()
->default(fake()->name())
->maxLength(255),
Forms\Components\TextInput::make('email')
->email()
->default(fake()->unique()->safeEmail())
->required()
->maxLength(255),
Forms\Components\DateTimePicker::make('email_verified_at'),
Forms\Components\TextInput::make('password')
->password()
->required()->visibleOn(['create'])
->maxLength(255)->default(fake()->password(8)),
Forms\Components\TextInput::make('phone')
->tel()
->maxLength(255),
Forms\Components\TextInput::make('address')
->maxLength(255),
Forms\Components\TextInput::make('city')
->maxLength(255),
Forms\Components\TextInput::make('state')
->maxLength(255),
Forms\Components\TextInput::make('zip')
->maxLength(255),
Forms\Components\Select::make('role') // also tried role_id
->relationship('organizationRoles', 'name')
]);
return $form
->schema([
Forms\Components\Select::make('country_id')
->relationship('country', 'name'),
Forms\Components\TextInput::make('name')
->required()
->default(fake()->name())
->maxLength(255),
Forms\Components\TextInput::make('email')
->email()
->default(fake()->unique()->safeEmail())
->required()
->maxLength(255),
Forms\Components\DateTimePicker::make('email_verified_at'),
Forms\Components\TextInput::make('password')
->password()
->required()->visibleOn(['create'])
->maxLength(255)->default(fake()->password(8)),
Forms\Components\TextInput::make('phone')
->tel()
->maxLength(255),
Forms\Components\TextInput::make('address')
->maxLength(255),
Forms\Components\TextInput::make('city')
->maxLength(255),
Forms\Components\TextInput::make('state')
->maxLength(255),
Forms\Components\TextInput::make('zip')
->maxLength(255),
Forms\Components\Select::make('role') // also tried role_id
->relationship('organizationRoles', 'name')
]);
3 Replies
N. Jacobsen
N. JacobsenOPβ€’16mo ago
This is the DB Diagram.
Patrick Boivin
Patrick Boivinβ€’16mo ago
Looks like you don't have a default value for role_id in the database and the column is not nullable... Oh I see.. Where does organizationRoles come from? Can you share how the relationships are setup in your models?
N. Jacobsen
N. JacobsenOPβ€’16mo ago
I will send some code later today πŸ™‚
Want results from more Discord servers?
Add your server