Laravel Livewire Model set default value

1.1k Views Asked by At

I have a table that I am generating through an iterative loop. The issue is that there is an input field of type date. When I try to attach my livewire model, it doesn't show the value coming from the database.

<input wire:model.defer="DurationTo"  class="form-control form-control-solid ps-12" placeholder="Select a date" name="duration_to" type="date"
                   value="{{ $table->duration_to->format('Y-m-d') }}"/>

If I remove

wire:model.defer="DurationTo"

Then it start showing the default value otherwise it show empty. But if I remove binding then obviously I will get nothing in the model to update. Kindly guide what is the better way of doing this

0

There are 0 best solutions below