create foreign key laravel migration

PHP
Schema::table('posts', function (Blueprint $table) {
    $table->unsignedInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});$table->foreign('column_name')->references('id')->on('table_name')->onDelete('cascade');$table->bigInteger('votes');
Source

Also in PHP: