It looks like you're trying to set a default value for the uuid column using the MySQL UUID() function directly in your Laravel migration. However, the syntax error you're encountering is likely due to the way you're trying to set the default value.
To fix this, you can use a raw expression within the default method. Here's how you can modify your migration to correctly set the default value for the uuid column:
public function up()
{
Schema::create('user_admins', function (Blueprint $table) {
$table->increments('id');
$table->uuid('uuid')->default(DB::raw('UUID()'))->index();
$table->string('email')->unique();
$table->string('password');
$table->timestamps();
});
}
Make sure that you have the uuid method available in your version of Laravel. If it's not available, you can define the uuid column as a string with a length of 36 characters:
$table->char('uuid', 36)->default(DB::raw('UUID()'))->index();
Also, ensure that your database user has the necessary privileges to execute the UUID() function.
After making these changes, you should be able to run your migration without encountering the syntax error. Remember to run the migration with the following command:
php artisan migrate
This will create a new table user_admins with both an auto-incrementing id and a uuid that is automatically generated for each new record.