S
S
Speakermen2021-03-08 11:35:44
SQL
Speakermen, 2021-03-08 11:35:44

How to use JOIN in Eloquent ORM?

Good day, I don’t understand what’s wrong with returning 1 table and not 2 together.

Used hasOne, belongsTo, hasMany, hasOneThrough. dear programmers help encoder please

There's also Personal Info, Hobbies and Interests, Education and Employement 3 tables will be related to id_user

Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('firstname');
            $table->string('lastname');
            $table->string('status')->nullable();
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->string('birthday')->nullable();
            $table->enum('gender', [1, 2]);
            $table->string('profile_photo')->default('/img/author-main1.jpg');
            $table->string('header_photo')->default('/img/top-header1.jpg');
            $table->rememberToken();
            $table->timestamps();
        });


//Personal Info
Schema::create('abouts', function (Blueprint $table) {
            $table->id();
            $table->string('about_me')->nullable();
            $table->string('birthplace')->nullable();
            $table->string('lives_in')->nullable();
            $table->string('occupation')->nullable();
            $table->string('joined')->nullable();
            $table->string('status')->nullable();
            $table->string('website')->nullable();
            $table->string('phone_number')->nullable();
            $table->string('religious_belifs')->nullable();
            $table->string('political_Incline')->nullable();
            $table->string('facebook')->nullable();
            $table->string('twitter')->nullable();
            $table->string('rss')->nullable();
            $table->string('dribbble')->nullable();
            $table->string('spotify')->nullable();
            $table->integer('user_id')->unsigned();
            $table->timestamps();
        });


SELECT abouts.about_me, abouts.birthplace, abouts.lives_in, abouts.occupation, abouts.joined, abouts.website, abouts.phone_number, abouts.religious_belifs, abouts.political_Incline, abouts.facebook, abouts.twitter, abouts.rss, abouts.dribbble, abouts.spotify, users.firstname, users.lastname, users.email, users.birthday, users.gender
FROM abouts
   INNER JOIN users
      ON abouts.user_id = users.id;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question