有没有一种方法可以在Laravel的模式生成器中指定外部约束的名称


Is there a way to specify a name for foreign constraints in the schema builder of Laravel?

为什么外部约束名称没有'DB_PREFIX'指定的前缀?使用相同数据库的两个程序将失败,因为它们具有相同的约束名称。我试着在谷歌上搜索它并阅读Laravel文档,但我什么都找不到。

根据API文档,您可以为反对方提供自定义名称

Fluent foreign(string|array $columns, string $name = null)