add unique key constraint multiple columns laravel code example Example: laravel unique multiple columns $table->unique(['mytext', 'user_id']);