在Laravel中使用迁移重命名表

AJ

我正在运行迁移以重命名表,但出现一个奇怪的错误。

public function up()
{   
    Schema::rename($accounts, $feeds);
}   

public function down()
{   
    Schema::rename($feeds, $accounts);
}   

错误

Undefined variable: accounts

表肯定存在。知道可能是什么问题吗?

阿列克谢·梅曾宁(Alexey Mezenin)

您应该使用字符串而不是变量:

public function up()
{   
    Schema::rename('accounts', 'feeds');
}   

public function down()
{   
    Schema::rename('feeds', 'accounts');
}   

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章