Hi, i am trying to port an old(php 5.6) dating script to laravel and i am finding it very dificult to find the best relationships for the models.
The migration files has about 39 tables like so:
Schema::create('tbld_bodytypes', function (Blueprint $table) { $table->smallIncrements('BodyTypeID')->unsigned()->primary(); $table->string('L1BodyType', 30); $table->string('L2BodyType', 30); $table->string('L3BodyType', 30); $table->string('L4BodyType', 30); $table->smallInteger('TopSorted')->default(0);
Schema::create('tbld_gender', function (Blueprint $table) { $table->smallIncrements('GenderID')->unsigned()->primary(); $table->string('L1Gender', 6); $table->string('L2Gender', 12); $table->string('L3Gender', 12); $table->string('L4Gender', 12); $table->tinyInteger('TopSorted')->nullable();
Bla,
Bla,
Bla.
Then it all connects to the profile table, i mean the user set's his/her gender, hair color, body type and the profile table display the results like so:
Schema::create('tbld_users', function (Blueprint $table) { $table->unsignedSmallInteger('GenderID')->nullable(); $table->unsignedSmallInteger('HeightID')->nullable(); $table->unsignedSmallInteger('Age')->nullable(); $table->unsignedSmallInteger('BodyTypeID')->nullable(); $table->unsignedSmallInteger('HairColorID')->nullable(); $table->unsignedSmallInteger('EyeColorID')->nullable();
Now what will be the relationship for the models?
Please help.
Thanks a lot for your response. I am using the profiles table instead of the users table so i am looking for a way to link the tables to the profiles table. I have been able to link the users table to the profiles table so when user registers a profile table is created as well and the profiles table have a corresponding users id which displays the username in the profiles table, but i have also link the genders table to the profiles table and the profiles table is not displaying the gender. Please i am looking for a way to link the genders table, bodytypes table, countries table etc, etc to the profiles table. Thanks.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community