Skip to content

Setting Prebuilt Blocks (Template) into the PageBuilder #84

Answered by Z3d0X
Seyikins27 asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think you can use $set directly on a FileUpload input. Instead try something like this:

->afterStateUpdated(function ($state, $livewire) {
    if(blank($state)) {
        $blocks = null;
    } else {
        $template = Template::find($state);
        $blocks = $template->blocks;
    }

    $newState = [
        ...$livewire->form->getRawState(),
        'blocks' => $blocks,
    ];

    $livewire->form->fill($newState);
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Seyikins27
Comment options

Answer selected by Seyikins27
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