Php 重复的列名Laravel

Php 重复的列名Laravel,php,mysql,laravel,laravel-5,artisan-migrate,Php,Mysql,Laravel,Laravel 5,Artisan Migrate,我正在Laravel中创建迁移,当我运行命令php artisan migrate时,该命令给出以下错误 重复的列名“user\u id”(“id”int unsigned not null自动增量主键,“user\u id”int unsigned not null,“user\u id”int not null,“order\u id”int unsigned not null,“order\u id”int not null)默认字符集utf8 collate utf8\u unicode

我正在Laravel中创建迁移,当我运行命令
php artisan migrate
时,该命令给出以下错误

重复的列名“user\u id”(“id”int unsigned not null自动增量主键,“user\u id”int unsigned not null,“user\u id”int not null,“order\u id”int unsigned not null,“order\u id”int not null)默认字符集utf8 collate utf8\u unicode\u ci)

这是我的迁移:

<?php

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

class CreateUserOrrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
         Schema::create('user_orrder', function (Blueprint $table) {

            $table->increments('id');

            $table->integer('user_id')->unsigned();
            $table->integer('user_id')->references('id')->on('users');

            $table->integer('order_id')->unsigned();
            $table->integer('order_id')->references('id')->on('orders');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_orrder');
    }
}

您的代码应该是:

$table->foreign('user_id')->references('id')->on('users');
而不是('users')上的
$table->integer('user_id')->引用('id')->

读这本书