sindyko's avatar

sindyko wrote a reply+100 XP

5mos ago

its module system, currlm-select-block ist module. I am use interNachi modular. iam customize him

sindyko's avatar

sindyko started a new conversation+100 XP

5mos ago

I have a parent component that acts as the core component, unaware of its children. I've tried many different approaches, including trying neural networks on this issue, but it's been no help. So, to avoid asking questions directly, and simply simulating a presentation example, another component is added to the parent component, and no data validation occurs when using any hook. So, if allowed, I'd like to update the updated dd() to handle the error message during the view and generally handle the validation to confirm that nothing is happening. Here is the pseudo code its child

public array $settings = [
        'list_model' => '',
        'list_id' => '',
        'placeholder' => '',
        'is_multi' => false,
    ];

    public function rules(): array
    {
        return [
            'settings.list_model' => ['required', 'string'],
            'settings.list_id' => ['nullable', 'integer'],
            'settings.placeholder' => ['required', 'string', 'min:255'],
            'settings.is_multi' => ['boolean'],
        ];
    }

    public function updated(): void
    {
//        dd('ger');
        $this->validate();
    }

its view child

<div>
        <div class="mb-3">
            <label>Модель списка</label>
            <input type="text" class="form-control" wire:model.live="settings.list_model">
            @error('settings.list_model') <div class="invalid-feedback">{{ $message }}</div> @enderror
        </div>

        <div class="mb-3">
            <label>Placeholder</label>
            <input type="text" class="form-control" wire:model.live="settings.placeholder">
            @error('settings.placeholder') <div class="invalid-feedback">{{ $message }}</div> @enderror
        </div>

        <div class="form-check">
            <input type="checkbox" class="form-check-input" wire:model.live="settings.is_multi" id="multi">
            <label for="multi" class="form-check-label">Множественный выбор</label>
        </div>
    @php(print_r($this->settings))
</div>

its call component in parent

<livewire:currlm-select-block::currlm-select-block-setting :settings="$form->settings" :key="'asdas'"/>

What am I doing wrong? Please point me in the right direction. Initially, everything was done using #[Modelable] and dynamic-component, but I've only done this for now for testing.