Joined November 2013
·

Adam

Software and Web Developer at Pierce County Community Newspaper Group
·
Tacoma, Washington
·

@rizwaniqbal

Thanks so much for the clarification. I was struggling with this for a few days and it really helped.

In the above example, what table is the last bit of code in? It all looks as if it's just referencing itself.

My understanding is it should be:

Schema::create('users',function(Blueprint $table) {
  $table->increments('id');
  $table->unsignedInteger('user_id');
}

Schema::create('user_profiles', function(Blueprint $table) {
  $table->foreign('user_fk_id')->references('id')->on('users');
}

However, this just doesn't make sense as the unsignedInteger('user_id'); is never referenced.

Achievements
1 Karma
0 Total ProTip Views