What could I do to select all column 1 row from 3 table in laravel 5.4 ?
I want to select posts, comments , users where post_id = comment.post_id
and comment.user_id = user.id
.
show it in single page post with post_title
, Comment By username
I has 3 table like this
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->text('title');
$table->longText('description');
$table->text('image');
$table->timestamps();
});
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->longText('comment');
$table->integer('user_id');
$table->integer('post_id');
$table->timestamps();
});
Schema::create('users',function (Blueprint $table){
$table->increments('id');
$table->string('username',30)->unique();
$table->string('email')->unique();
$table->string('password',60);
$table->rememberToken();
$table->timestamps();
});
thank for your answer.
via Chando