Php Laravel 4-在控制器中使用重命名列
我想在控制器中使用artisan迁移,如下所示Php Laravel 4-在控制器中使用重命名列,php,laravel,doctrine,laravel-4,database-migration,Php,Laravel,Doctrine,Laravel 4,Database Migration,我想在控制器中使用artisan迁移,如下所示 echo '<br>init migrate:install...'; Artisan::call('migrate'); echo 'done migrate:install'; 更新 使用终端迁移时出现相同错误 第二次更新 app/database/migrations上的迁移代码示例 use Illuminate\Database\Migrations\Migration; class UpdatePostsTable ext
echo '<br>init migrate:install...';
Artisan::call('migrate');
echo 'done migrate:install';
更新
使用终端迁移时出现相同错误
第二次更新
app/database/migrations上的迁移代码示例
use Illuminate\Database\Migrations\Migration;
class UpdatePostsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user', function($table)
{
$table->renameColumn('fullname', 'full_name');
});
}
}
将
doctor/dbal
依赖项添加到composer.json
文件中
有关更多信息,请参见本页文档的最底部
将原则/dbal依赖项添加到composer.json文件中,如
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"illuminate/html": "5.*",
"doctrine/dbal": "~2.3"
},
然后使用sudo composer update命令更新composer,这将起作用。您能在终端中正常运行它吗?@DennisBraga不能。我收到同样的错误。有什么想法吗?请发布你的迁移代码。如果你像我一样,不知道如何添加这种依赖关系,这里有一个链接可以找到答案。向composer.json文件中添加条令/dbal依赖项也很好,请参考已接受的答案。
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"illuminate/html": "5.*",
"doctrine/dbal": "~2.3"
},