Skip to content

Commit 78c275c

Browse files
committed
Use "date()" Instead of "now()"
1 parent 84af5af commit 78c275c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Commands/MakeMySqlRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function handle(): int
151151
if (!in_array($_column->COLUMN_NAME, ['id', 'created_at', 'updated_at', 'deleted_at'])) {
152152
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => \$" . $entityVariableName . "->get" . ucfirst(camel_case($_column->COLUMN_NAME)) . "(),";
153153
} elseif ($_column->COLUMN_NAME === 'created_at') {
154-
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => now()->toDateTimeString(),";
154+
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => date('Y-m-d H:i:s'),";
155155
}
156156
}
157157
$mysqlRepositoryContent .= "\n\t\t\t]);\n";
@@ -168,7 +168,7 @@ public function handle(): int
168168
if (!in_array($_column->COLUMN_NAME, ['id', 'created_at', 'updated_at', 'deleted_at'])) {
169169
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => \$" . $entityVariableName . "->get" . ucfirst(camel_case($_column->COLUMN_NAME)) . "(),";
170170
} elseif ($_column->COLUMN_NAME === 'updated_at') {
171-
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => now()->toDateTimeString(),";
171+
$mysqlRepositoryContent .= "\n\t\t\t\t'" . $_column->COLUMN_NAME . "' => date('Y-m-d H:i:s'),";
172172
}
173173
}
174174
$mysqlRepositoryContent .= "\n\t\t\t]);\n\t}\n";
@@ -180,7 +180,7 @@ public function handle(): int
180180
$mysqlRepositoryContent .= "\n\t\treturn \$this->newQuery()";
181181
$mysqlRepositoryContent .= "\n\t\t\t->where(\$this->primaryKey, \$" . $entityVariableName . "->getPrimaryKey())";
182182
$mysqlRepositoryContent .= "\n\t\t\t->update([";
183-
$mysqlRepositoryContent .= "\n\t\t\t\t'deleted_at' => now()->toDateTimeString(),";
183+
$mysqlRepositoryContent .= "\n\t\t\t\t'deleted_at' => date('Y-m-d H:i:s'),";
184184
$mysqlRepositoryContent .= "\n\t\t\t]);\n\t}\n";
185185

186186
$mysqlRepositoryContent .= "\n\t/**\n\t * @param $entityName \$$entityVariableName\n\t * @return int\n\t */";

0 commit comments

Comments
 (0)