So I have two models, A CharacterAppearance model (what a user is wearing) and a Item model (things user can wear) The items table's schema is this:
Schema::create('items', function (Blueprint $table) {
$table->integer("asset_id", false);
$table->timestamps();
$table->softDeletes();
$table->integer("type");
$table->integer("user_id", false, true);
$table->string("name");
$table->string("description");
$table->integer("chaobuxPrice");
$table->integer("ticketsPrice");
$table->integer("number_sold");
$table->integer("number_favorited");
$table->integer("clientYear");
$table->string("genres");
$table->string("renderJobID");
});
while the CharacterAppearances is this:
Schema::create('character_appearances', function (Blueprint $table) {
$table->integer("user_id", true);
$table->integer("Hat1");
$table->integer("Hat2");
$table->integer("Hat3");
$table->integer("Hat4");
$table->integer("Head");
$table->integer("Face");
$table->integer("Pants");
$table->integer("Shirts");
$table->integer("TShirts");
$table->integer("Package");
$table->integer("Gear");
});
(Note that user_id in items represents the owner while in characterappearance it represents the user_id of said characterappearance. Also note that CharacterAppearances and Users have a One to One relationship.)
Now, my question is this: How can I connect items via a hasMany relationship to any of the values in characterappearance?
So like if Character appearance's Tshirt column value for User with ID of one is item id of 3, how could I establish a relationship while also allowing another item_id in the hat column and another id with completely different values?