diff --git a/src/Controllers/Controller.php b/src/Controllers/Controller.php index 60e0be2e..9ec2b904 100644 --- a/src/Controllers/Controller.php +++ b/src/Controllers/Controller.php @@ -130,19 +130,31 @@ public function getContentByType($data_type, $data_row, $value) $return_value = $value; break; case 'time': - $z_removed = explode('.', $value)[0]; - $time = explode('T', $z_removed)[1]; - $return_value = $time; + if ($value == null){ + $return_value = $value; + }else{ + $z_removed = explode('.', $value)[0]; + $time = explode('T', $z_removed)[1]; + $return_value = $time; + } break; case 'date': - $z_removed = explode('.', $value)[0]; - $date = explode('T', $z_removed)[0]; - $return_value = $date; + if($value == null){ + $return_value = $value; + }else{ + $z_removed = explode('.', $value)[0]; + $date = explode('T', $z_removed)[0]; + $return_value = $date; + } break; case 'datetime': - $z_removed = explode('.', $value)[0]; - $date_time = str_replace('T', ' ', $z_removed); - $return_value = $date_time; + if($value == null){ + $return_value = $value; + }else{ + $z_removed = explode('.', $value)[0]; + $date_time = str_replace('T', ' ', $z_removed); + $return_value = $date_time; + } break; case 'select': $return_value = $value; @@ -373,7 +385,6 @@ public function insertData($data, $data_type) } } } - $id = DB::table($data_type->name)->insertGetId($new_data); $model = DB::table($data_type->name)->where('id', $id)->first(); foreach ($data as $key => $value) { @@ -567,7 +578,7 @@ public function updateData($data, $data_type) } if (in_array($data_row->type, [ - 'number', + 'number','datetime','date','time' ])) { $new_data[$key] = $this->getContentByType($data_type, $data_row, $value) !== null ? $this->getContentByType($data_type, $data_row, $value) : null; } else { diff --git a/src/resources/js/pages/crud-generated/edit.vue b/src/resources/js/pages/crud-generated/edit.vue index a8670b94..914a7cf0 100644 --- a/src/resources/js/pages/crud-generated/edit.vue +++ b/src/resources/js/pages/crud-generated/edit.vue @@ -26,7 +26,6 @@