'Livewire @entangle issue with mutliple post
I'm actually using a component I made using Livewire and AlpineJS.
The issue I got is the following :
I have a button to add a new section, in this section I can wrote title and description (wysiwyg editor) so to handle this I have in my component :
<div
x-data="{content: @entangle($attributes->wire('model')),...setupEditor()}"
x-init="() => init($refs.editor)"
wire:ignore
{{ $attributes->whereDoesntStartWith('wire:model') }}>
And in my livewire php file :
protected $rules = [
'newLesson.*.title' => 'required|string',
'newLesson.*.lesson_content' => 'required|string',
'newLesson.*.type_content' => 'required|string',
];
So in my livewire blade I have something like this :
<x-editor wire:model.lazy="newLesson.{{$i}}.lesson_content"></x-editor>
But when I try, I've got an error in my console :
SupportAlpine.js:102 Livewire Entangle Error: Livewire property 'newLesson.4.lesson_content' cannot be found
Did some of you already got this kind of issue ? I don't really know how to handle it actually. Thanks for your time and help :)
Solution 1:[1]
Worked through the issue on Livewire discord and solved it ?
For anyone else coming across it, the addLesson method was referencing $newLessons instead of $newLesson.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stanislaw Szenk |