I am trying to create a many to many following relationship in Laravel. So far all of the solutions, such as this one Laravel follower/following relationships, I am finding are where a user can follow a profile. In my case a user can have many profiles so I want to make it so profiles can follow profiles.
I am new to Laravel and was told there is a naming convention. I created the migration with
php artisan make:migration creates_profile_profile_pivot_table --create profile_profile
And this is my schema
public function up()
{
Schema::create('profile_profile', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('profile_id');
$table->unsignedBigInteger('profile_id');
$table->timestamps();
});
}
I get the error
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 duplicate column name: profile_id (SQL: create table "profile_profile" ("id" integer not null primary key autoincrement, "profile_id" integer not null, "profile_id" integer not null, "created_at" datetime null, "updated_at" datetime null))
If I replace the two profile_id's with following_id and follower_id will that clash with the naming convention?