Answers for "how to set unique in laravel migration"

PHP
1

laravel migration add unique column

Schema::table('tableName', function($table)
{
    $table->string('column-name')->unique(); //notice the parenthesis I added
});
Posted by: Guest on November-20-2020
1

laravel migration alter column unique

$table->dropUnique('users_email_unique');
Posted by: Guest on August-31-2021

Code answers related to "how to set unique in laravel migration"

Browse Popular Code Answers by Language