Skip to content

How can I interact field values before save (Model Resource with Pages) #1388

Answered by lee-to
WillieOng-HK asked this question in Q&A
Discussion options

You must be logged in to vote

StackFields for index, use Template

Template::make('Config', 'config')->fields([
                        Text::make('Language'),
                        Text::make('Cache'),
                    ])
                        ->changeFill(fn(mixed $data) => data_get($data, 'config'))
                        ->changeRender(fn(mixed $value, Template $ctx) => FieldsGroup::make($ctx->getPreparedFields())->fill($value))
                        ->onApply(function(mixed $item, mixed $value) {
                            $item->config = $value;
                            
                            return $item;
                        })

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@WillieOng-HK
Comment options

@lee-to
Comment options

Comment options

You must be logged in to vote
4 replies
@lee-to
Comment options

@WillieOng-HK
Comment options

@lee-to
Comment options

Answer selected by WillieOng-HK
@WillieOng-HK
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants