@Speakermen

Как использовать JOIN в Eloquent ORM?

Доброго времени суток не пойму что не так возвращает 1 таблицу а не 2 вместе.

Использовал hasOne, belongsTo, hasMany, hasOneThrough. уважаемые программисты help кодеру please

Там ещё Personal Info, Hobbies and Interests, Education and Employement 3 таблицы будут которые относятся к 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;
  • Вопрос задан
  • 155 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы