diff --git a/src/Sushi.php b/src/Sushi.php index 0c9b941..eaa92b6 100644 --- a/src/Sushi.php +++ b/src/Sushi.php @@ -133,16 +133,9 @@ public function migrate() $this->createTableWithNoData($tableName); } - if (count($this->casts) > 0) { - foreach ($rows as $row) { - // If $casts are present, use Eloquent's "create" instead of a plain insert so they are used and applied... - static::forceCreate($row); - } - } else { - foreach (array_chunk($rows, $this->getSushiInsertChunkSize()) ?? [] as $inserts) { - if (! empty($inserts)) { - static::insert($inserts); - } + foreach (array_chunk($rows, $this->getSushiInsertChunkSize()) ?? [] as $inserts) { + if (! empty($inserts)) { + static::insert($inserts); } } } diff --git a/tests/SushiTest.php b/tests/SushiTest.php index aad9b73..6d16159 100644 --- a/tests/SushiTest.php +++ b/tests/SushiTest.php @@ -60,15 +60,6 @@ function columns_with_varying_types() $this->assertEquals(null, $row->null); } - /** @test */ - function model_with_casts() - { - $model = ModelWithCasts::first(); - - $this->assertTrue(is_array($model->is_array)); - $this->assertTrue(is_bool($model->is_boolean)); - } - /** @test */ function model_with_custom_schema() { @@ -382,18 +373,3 @@ public function maki() return $this->belongsTo(Maki::class); } } - - -class ModelWithCasts extends Model -{ - use \Sushi\Sushi; - - protected $casts = [ - 'is_array' => 'array', - 'is_boolean' => 'boolean', - ]; - - protected $rows = [ - ['is_array' => [1, 2, 3], 'is_boolean' => true], - ]; -}