A.J*_*A.J 3 php sql migration laravel
我正在运行迁移以重命名表,但我得到一个奇怪的错误.
public function up()
{
Schema::rename($accounts, $feeds);
}
public function down()
{
Schema::rename($feeds, $accounts);
}
Run Code Online (Sandbox Code Playgroud)
错误:
Undefined variable: accounts
表绝对存在.知道可能是什么问题吗?
你应该使用字符串而不是变量:
public function up()
{
Schema::rename('accounts', 'feeds');
}
public function down()
{
Schema::rename('feeds', 'accounts');
}
Run Code Online (Sandbox Code Playgroud)