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.
Try with only one field to see if it works
plz show me ur updated code again if can
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);
}
try this. $this->attributes['graduationDate'] = $value ? $value : null;
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')),
]);
}
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
This will be better rather than adding logic in ur controller. read hear http://laravel.com/docs/master/eloquent-mutators#accessors-and-mutators
public function setGraduationDateAttribute($value)
{
if($value){
$this->attributes['graduationDate']=Carbon::createFromFormat('d-m-Y', $value);
}
}
Please or to participate in this conversation.