1
votes

This is my controller and columns type is int(11) in database

 $req['date_time'] = ($req->date_time) ? Carbon::createFromFormat('d/m/Y', $req->date_time)->timestamp : '0';
                $req['publish_date'] = ($req->publish_date) ? Carbon::createFromFormat('d/m/Y', $req->publish_date)->timestamp : '0';
                $req['expiration_date'] = ($req->expiration_date) ? Carbon::createFromFormat('d/m/Y', $req->expiration_date)->timestamp : '0';
                CmsArticle::create($req->all());                                           
1
during edit the date it is working but not in storing - Faisal Faisi

1 Answers

0
votes

Are you sure all the columns are integers? SQL Server returns that error when an invalid value is used where a datetime type is needed.

Perhaps the value 0 shouldn't be used, and instead insert a null or a special date far in the past?