@TheHamsterOfGod You don’t want a table per provider. Just have one table, called social_profiles or similar. Your provider column can be a foreign key if needs be. That way, if I add Facebook to my account, then it would insert a record into the social_profiles table like this:
User::socialProfiles()->insert([
'provider_id' => 1, // Imagine Facebook has an ID of 1 in your providers table
'uid' => $facebook->getId(), // My Facebook profile ID
]);
This way users can add as many social profiles to their account as your site supports. And to ensure a user can only add one social profile per provider, add an unique constraint on the provider_id and user_id columns so each user can only have one combination of each.
Schema::create('social_profiles', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('provider_id')->unsigned();
$table->string('uid');
$table->timestamps();
$table->unique(['user_id', 'provider_id']);
$table->unique(['provider_id', 'uid']);
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('provider_id')->references('id')->on('providers')->onDelete('cascade');
});
I’ve also added an additional unique constraint on the above so that provider ID and UID are an unique combination, as you don’t want two different users to assign the same, say Facebook, account to their account in your application.