The tanggal_lahir field is used in my Model Mutator $dates
protected $dates = ['tanggal_lahir'];
When the tanggal_lahir is saved into that Model, it shows error Carbon: Data missing.
InvalidArgumentException in Carbon.php line 425:
Data missing
in Carbon.php line 425
at Carbon::createFromFormat('Y-m-d H:i:s', '2010-1-1') in Model.php line 3015
at Model->asDateTime('2010-1-1') in Model.php line 2971
at Model->fromDateTime('2010-1-1') in Model.php line 2926
at Model->setAttribute('tanggal_lahir', '2010-1-1') in Model.php line 446
at Model->fill(array('nama' => 'oaskdosk', 'nomor_identitas' => '123123', 'agama' => 'ISLAM', 'pendidikan' => 'TIDAK_SEKOLAH', 'pekerjaan' => 'PNS', 'telepon' => '', 'alamat' => '', 'status_pernikahan' => 'MENIKAH', 'nama_pasangan' => '', 'nama_ayah' => '', 'nama_ibu' => '', 'tanggal_lahir' => '2010-1-1')) in Model.php line 280
at Model->__construct(array('nama' => 'oaskdosk', 'nomor_identitas' => '123123', 'agama' => 'ISLAM', 'pendidikan' => 'TIDAK_SEKOLAH', 'pekerjaan' => 'PNS', 'telepon' => '', 'alamat' => '', 'status_pernikahan' => 'MENIKAH', 'nama_pasangan' => '', 'nama_ayah' => '', 'nama_ibu' => '', 'tanggal_lahir' => '2010-1-1')) in Model.php line 500
at Model->newInstance(array('nama' => 'oaskdosk', 'nomor_identitas' => '123123', 'agama' => 'ISLAM', 'pendidikan' => 'TIDAK_SEKOLAH', 'pekerjaan' => 'PNS', 'telepon' => '', 'alamat' => '', 'status_pernikahan' => 'MENIKAH', 'nama_pasangan' => '', 'nama_ayah' => '', 'nama_ibu' => '', 'tanggal_lahir' => '2010-1-1')) in BaseRepository.php line 390
at BaseRepository->create(array('nama' => 'oaskdosk', 'nomor_identitas' => '123123', 'agama' => 'ISLAM', 'pendidikan' => 'TIDAK_SEKOLAH', 'pekerjaan' => 'PNS', 'telepon' => '', 'alamat' => '', 'status_pernikahan' => 'MENIKAH', 'nama_pasangan' => '', 'nama_ayah' => '', 'nama_ibu' => '', 'tanggal_lahir' => '2010-1-1')) in SesiPengkajian.php line 47
I think it is because Model $dates expect 'Y-m-d H:i:s' format from the tanggal_lahir to be converted by Carbon, but tanggal_lahir just have 'Y-m-d' format that composed from the SelectDateMiddleware.
I have
The
tanggal_lahir
field is used in my Model Mutator $datesWhen the tanggal_lahir is saved into that Model, it shows error Carbon: Data missing.
I think it is because Model $dates expect 'Y-m-d H:i:s' format from the tanggal_lahir to be converted by Carbon, but tanggal_lahir just have 'Y-m-d' format that composed from the SelectDateMiddleware.
Is it a bug or i am missing something?