Skip to content

Commit 375bec9

Browse files
committed
update: seed 参数过滤
1 parent a4f2335 commit 375bec9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

laravel/database/seeds/DatabaseSeeder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public function run()
2525
$this->foreign(1);
2626
}
2727

28-
public function foreign($type = 0)
28+
private function foreign($type = 0)
2929
{
30-
DB::statement("SET FOREIGN_KEY_CHECKS=$type");
30+
if (in_array($type, [0, 1])) {
31+
DB::statement("SET FOREIGN_KEY_CHECKS=$type");
32+
}
3133
}
3234
}

0 commit comments

Comments
 (0)