相关疑难解决方法(0)

Laravel 5.1 播种新列

我有一个数据库表locations,我需要添加一个新status列。我已经设置了以下迁移文件,它在我运行时添加了该字段php artisan migrate,但是如何Active为表中的每一行插入一个值?

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddStatusToLocationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('locations', function(Blueprint $table)
        {
            $table->string('status')->after('email');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('locations', function(Blueprint $table)
        {
            $table->dropColumn('status');
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5

5
推荐指数
1
解决办法
3263
查看次数

标签 统计

laravel ×1

laravel-5 ×1

php ×1