Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Qlic's avatar
Level 18

Even if i completely remove the if/else and go straight to the update code with a diedump directly afterwards, it reloads the page without notices.

pmall's avatar

Try with only one field to see if it works

Qlic's avatar
Level 18

I found out that it's being caused by the following form field:

{!! Form::text('graduationDate', $user->student->graduationDate ? $user->student->graduationDate->format('d-m-Y') : null, ['class' => 'form-control datepicker', 'data-date-format' => 'dd-mm-yyyy', 'placeholder' => 'DD-MM-JJ']) !!}

If i comment that field out, the query works! So the question is, is there something wrong with the form field, or is it due to the following in my student model:

    public function setGraduationDateAttribute($value)
    {
        $this->setAttribute('graduationDate', $value ? $value : null);
    }
veve286's avatar
veve286
Best Answer
Level 8

try this. $this->attributes['graduationDate'] = $value ? $value : null;

Qlic's avatar
Level 18

Thanks a bunch, that finally made it all work. Although inside the request i also added this to transform the date format.

if ($this->input('graduationDate'))
        {
            $this->request->add([
                'graduationDate' => Carbon::createFromFormat('d-m-Y', $this->input('graduationDate')),
            ]);
        }
pmall's avatar

Thanks a bunch, that finally made it all work. Although inside the request i also added this to transform the date format.

Put this in your mutator it is cleaner

Previous

Please or to participate in this conversation.