Laravel 5.2:类Carbon \ Carbon的对象无法转换为int错误

I am trying to create array in Laravel 5.2 like this:

$newArray = array('il' => $result['il'],
                                'ckys' => intval($result['ckys_kurum_kodu']),
                                'kurum' => $result['kurum'],
                                'aile_hekimligi' => intval($result['aile_hekimligi']),
                                'anesteziyoloji' => intval($result['anesteziyoloji']),
                                'beyin_sinir_cer' => intval($result['beyin_sinir_cer']),
                                'biyokimya' => intval($result['biyokimya']),
                                'cocuk_cer' => intval($result['cocuk_cer']),
                                'cocuk_hast' => intval($result['cocuk_hast']));

But I am getting this error:

Object of class Carbon\Carbon could not be converted to int

What is this error means and how can we handle the solution ?

Thanks

You can't convert date to an integer (only to Unix timestamp). But you can convert it to a string. For example, if cocuk_cer is a date, you can do this:

'cocuk_cer' => $result['cocuk_cer']->toDateTimeString(),

Do the same for all dates in an array.