Laravel命令提示符FatalErrorException“在null”

时间:2017-06-24 14:40:44

标签: php laravel

每当我尝试迁移时,我会在给定代码上得到FatalErrorException:

public function up()
{
    Schema::create('category_details', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->tinyInteger('status')->comment('0 => inactive, 1 => active');
        $table->timestamp('created_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP'));
        $table->interger('created_by');
        $table->timestamp('updated_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
        $table->interger('updated_by');
    });
}

1 个答案:

答案 0 :(得分:2)

您的架构不正确:

$table->interger('created_by');
$table->timestamp('updated_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->interger('updated_by');

应该是integer而不是interger

$table->integer('created_by');
$table->timestamp('updated_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->integer('updated_by'