composite unique between two columns laravel migration
snippet in php

laravel unique multiple columns

user2710

$table->unique(['mytext', 'user_id']);

composite unique between two columns laravel migration

user6986

    public function up()
    {
        Schema::table('user_projects', function (Blueprint $table) {
            $table->unique(["user_id", "project_id"], 'user_project_unique');
        });
    }

    public function down()
    {
        Schema::table('user_projects', function (Blueprint $table) {
          $table->dropUnique('user_project_unique');
        });
    }