外键在 laravel 5.4 中显示语法错误

foreign key shows syntax error in laravel 5.4

我已经创建了迁移文件,我写了:

public function up()
    {
        //
        Schema::create('ad_group', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('campaign_id')->unsigned();
            $table->char('name',32);
        });
        Schema::table('ad_group',function (Blueprint $table){
            $table->foreign('campaign_id')->references->('id')->on('campaigns');
        });
    }

其中 returns 错误如下:

[Symfony\Component\Debug\Exception\FatalThrowableError]
解析错误:语法错误,意外的 '(',期望标识符 (T_STRING) 或变量 (T_VARIABLE) 或 '{' 或 '$'

Your mistake is  "->references->('id')->" must be "->references('id')->"

public function up() {
    Schema::table('ad_group', function (Blueprint $table) {
          $table->foreign('campaign_id')->references('id')->on('campaigns');
    });
}

希望对您有所帮助:)