This is my structure, I want to connect these two tables in laravel, How to do it?
Post Table:
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();
});
}
Users Table:
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();
});
}