Laravel / Livewire input returning blank when using eloquent

62 Views Asked by At

using laravel livewire for a form, the form submits ok and if i enter details manually this works fine. However if i use an input it just returns null?

So for example.

$absence = Absence::create(['reason' => $this->reason_add]);

returns null in database or via dd();

$absence = Absence::create(['reason' => 'test']);

returns test in database as expected.

if run

dd($this->reason_add);

This returns the value as expected

i dont understand why soon as i add this to Absence::create the input returns null ?

Am i missing something.

Thanks.

1

There are 1 best solutions below

1
Dulshan DevOps On

when you running dd($this->reason_add); and it returns the value as expected i think wire:model='reason_add' pass correctly data to the function.So maybe problem in your model and check it.