nyannss
nyannss
FFilament
Created by nyannss on 5/30/2024 in #❓┊help
Get Relation Fieldset State / Set Outside State in Relationship Fieldset
Form resources that have fieldset relationship, how to get state that fieldset on outside? just for example :
[
Fieldset::make('User')
->relationship('users')
->schema([
TextInput::make('name')
->required(),
]),
TextInput::make('slug')
->dehydrateStateUsing(
fn(string $state, callable $get) => Str::slug($get('user.name')) // <-- when get this, the value is null
)
]
[
Fieldset::make('User')
->relationship('users')
->schema([
TextInput::make('name')
->required(),
]),
TextInput::make('slug')
->dehydrateStateUsing(
fn(string $state, callable $get) => Str::slug($get('user.name')) // <-- when get this, the value is null
)
]
or set outside state in relationship fieldset
[
Fieldset::make('User')
->relationship('users')
->schema([
TextInput::make('name')
->required()
->reactive()
->live()
->afterStateUpdated( callable $set) => $set('slug', Str::slug($state))),
// nothing happens
]),
TextInput::make('slug')
->prefix(config('app.url') . "/profile/")
]
[
Fieldset::make('User')
->relationship('users')
->schema([
TextInput::make('name')
->required()
->reactive()
->live()
->afterStateUpdated( callable $set) => $set('slug', Str::slug($state))),
// nothing happens
]),
TextInput::make('slug')
->prefix(config('app.url') . "/profile/")
]
24 replies
FFilament
Created by nyannss on 5/14/2024 in #❓┊help
Ignore null values save to database and create custom confirmation text
Hello! I'm new using fillament, i'm trying to do create form, so, how to ignore column when the value is null. Because in the migration, i have already defined the column is required and have default value. I dont want put the default value in form because in the placeholder there is a caption that explains, and I don't want it hiding because of the filled value. and one more, how to create custom confirmation text when saving data. cheers mate 🍺
9 replies