0

I have created migration file in that i have written :

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');
        });
    }

which returns error like this :

[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'

sumit
  • 15,003
  • 12
  • 69
  • 110

1 Answers1

0
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');
    });
}

Hope it help :)

Odin Thunder
  • 3,284
  • 2
  • 28
  • 47