diff --git a/src/CsvSeeder.php b/src/CsvSeeder.php index 63509f9..1ce9d1c 100644 --- a/src/CsvSeeder.php +++ b/src/CsvSeeder.php @@ -71,8 +71,8 @@ class CsvSeeder extends Seeder * created_at and updated_at values to be added to each row. Only used if * $this->timestamps is true */ - public string $created_at = ''; - public string $updated_at = ''; + public ?Carbon $created_at = null; + public ?Carbon $updated_at = null; /** * The mapping of CSV to DB column. If not specified manually, the first @@ -98,10 +98,10 @@ public function run() // Cache created_at and updated_at if we need to if ($this->timestamps) { if (!$this->created_at) { - $this->created_at = Carbon::now()->toIso8601String(); + $this->created_at = Carbon::now(); } if (!$this->updated_at) { - $this->updated_at = Carbon::now()->toIso8601String(); + $this->updated_at = Carbon::now(); } } diff --git a/tests/CsvTest.php b/tests/CsvTest.php index 8267cbe..4045332 100644 --- a/tests/CsvTest.php +++ b/tests/CsvTest.php @@ -190,7 +190,7 @@ public function it_adds_timestamps() // Test with timestamps $seeder->timestamps = true; - $seeder->created_at = \Carbon\Carbon::now()->toString(); + $seeder->created_at = \Carbon\Carbon::now(); $seeder->updated_at = $seeder->created_at; $actual = $seeder->readRow($row, $mapping); $expected = [