diff --git a/system/console/commands/make.php b/system/console/commands/make.php index 1262bad5..4e7728d8 100644 --- a/system/console/commands/make.php +++ b/system/console/commands/make.php @@ -5,6 +5,7 @@ defined('DS') or exit('No direct access.'); use System\Str; +use System\Carbon; use System\Storage; use System\Package; @@ -222,7 +223,7 @@ public function migration(array $arguments = []) throw new \Exception(sprintf('Targetted package is not installed: %s', $package)); } - $prefix = date('Y_m_d_His'); + $prefix = Carbon::now()->format('Y_m_d_His'); $path = Package::path($package) . 'migrations' . DS; if (!is_dir($path)) { diff --git a/system/database/facile/model.php b/system/database/facile/model.php index da116746..1aa353c4 100644 --- a/system/database/facile/model.php +++ b/system/database/facile/model.php @@ -7,6 +7,7 @@ use System\Arr; use System\Str; use System\Event; +use System\Carbon; use System\Validator; abstract class Model @@ -443,7 +444,7 @@ public function delete() */ public function timestamp() { - $this->updated_at = date('Y-m-d H:i:s'); + $this->updated_at = Carbon::now()->format('Y-m-d H:i:s'); if (!$this->exists) { $this->created_at = $this->updated_at; diff --git a/system/database/facile/relationships/belongstomany.php b/system/database/facile/relationships/belongstomany.php index ad7a44d2..7dfbb952 100644 --- a/system/database/facile/relationships/belongstomany.php +++ b/system/database/facile/relationships/belongstomany.php @@ -4,6 +4,7 @@ defined('DS') or exit('No direct access.'); +use System\Carbon; use System\Database\Facile\Model; use System\Database\Facile\Pivot; @@ -189,7 +190,7 @@ protected function join_record($id) protected function insert_joining(array $attributes) { if (Pivot::$timestamps) { - $attributes['created_at'] = date('Y-m-d H:i:s'); + $attributes['created_at'] = Carbon::now()->format('Y-m-d H:i:s'); $attributes['updated_at'] = $attributes['created_at']; } diff --git a/system/database/facile/relationships/hasoneormany.php b/system/database/facile/relationships/hasoneormany.php index 326a8bf3..98faa824 100644 --- a/system/database/facile/relationships/hasoneormany.php +++ b/system/database/facile/relationships/hasoneormany.php @@ -4,6 +4,7 @@ defined('DS') or exit('No direct access.'); +use System\Carbon; use System\Database\Facile\Model; class HasOneOrMany extends Relationship @@ -37,7 +38,7 @@ public function insert($attributes) public function update(array $attributes) { if ($this->model->timestamps()) { - $attributes['updated_at'] = date('Y-m-d H:i:s'); + $attributes['updated_at'] = Carbon::now()->format('Y-m-d H:i:s'); } return $this->table->update($attributes); diff --git a/system/email/drivers/driver.php b/system/email/drivers/driver.php index 301031a9..ba12bcfc 100644 --- a/system/email/drivers/driver.php +++ b/system/email/drivers/driver.php @@ -7,6 +7,7 @@ use System\Arr; use System\Str; use System\Email; +use System\Carbon; use System\Config; use System\Storage; @@ -552,7 +553,7 @@ public function send($validate = null) $this->headers = []; $boundary = md5(Str::random(16)); $this->boundaries = ['B1_' . $boundary, 'B2_' . $boundary, 'B3_' . $boundary]; - $this->set_header('Date', date('r')); + $this->set_header('Date', Carbon::now()->format('r')); $path = (false === $this->config['return_path']) ? $this->config['from']['email'] diff --git a/system/log.php b/system/log.php index 51af5301..fb12cbca 100644 --- a/system/log.php +++ b/system/log.php @@ -22,7 +22,7 @@ class Log */ public static function channel($name = null) { - $name = (is_string($name) && strlen($name)) ? Str::slug($name) : date('Y-m-d'); + $name = (is_string($name) && strlen($name)) ? Str::slug($name) : Carbon::now()->format('Y-m-d'); static::$channel = Str::replace_last('.log', '', Str::replace_last('.php', '', $name)); } @@ -79,7 +79,7 @@ protected static function write($type, $message, $data = null) } $channel = static::$channel; - $channel = (is_string($channel) && strlen($channel)) ? Str::slug($channel) : date('Y-m-d'); + $channel = (is_string($channel) && strlen($channel)) ? Str::slug($channel) : Carbon::now()->format('Y-m-d'); $path = path('storage') . 'logs' . DS . $channel . '.log.php'; $message = static::format($type, $message); @@ -97,6 +97,7 @@ protected static function write($type, $message, $data = null) protected static function format($type, $message) { $env = Foundation\Oops\Debugger::$productionMode ? 'production' : 'local'; - return sprintf('[%s] %s.%s: %s' . PHP_EOL, date('Y-m-d H:i:s'), $env, strtoupper((string) $type), $message); + $date = Carbon::now()->format('Y-m-d H:i:s'); + return sprintf('[%s] %s.%s: %s' . PHP_EOL, $date, $env, strtoupper((string) $type), $message); } }