这是我的结构,我想在laravel中连接这两个表,怎么做?
帖子表:
public function up()
{
Schema::create('post', function (Blueprint $table) {
$table->increments('post_id');
$table->string('post');
$table->integer('time');
$table->string('host');
$table->integer('vote_up');
$table->integer('vote_down');
$table->foreign('id_fk')->references('id')->on('users');
$table->timestamps();
});
}
用户表:
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->date('dob');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}