Answers for "eloquent migration unique value but not read only"

PHP
1

composite unique between two columns laravel migration

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');
        });
    }
Posted by: Guest on October-09-2020

Code answers related to "eloquent migration unique value but not read only"

Browse Popular Code Answers by Language