We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc26e19 commit 48e6355Copy full SHA for 48e6355
src/ActiveFixture.php
@@ -39,8 +39,16 @@ public function load(): void
39
$table = $this->getTable();
40
41
foreach ($this->getData() as $alias => $row) {
42
- $primaryKey = DB::table($table)->insertGetId($row);
43
- $this->data[$alias] = array_merge($row, ['id' => $primaryKey]);
+ if (Schema::hasColumns($this->table, ['id'])) {
+ $primaryKey = DB::table($table)->insertGetId($row);
44
+ $this->data[$alias] = array_merge($row, ['id' => $primaryKey]);
45
+ } else {
46
+ if (DB::table($table)->insert($row)) {
47
+ $this->data[$alias] = $row;
48
49
+ throw new Exception("Fixture does not loaded for table: {$this->table}");
50
+ }
51
52
}
53
54
0 commit comments