我正在运行迁移以重命名表,但出现一个奇怪的错误。
public function up()
{
Schema::rename($accounts, $feeds);
}
public function down()
{
Schema::rename($feeds, $accounts);
}
错误:
Undefined variable: accounts
表肯定存在。知道可能是什么问题吗?
您应该使用字符串而不是变量:
public function up()
{
Schema::rename('accounts', 'feeds');
}
public function down()
{
Schema::rename('feeds', 'accounts');
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句