'Laravel 8: How to set default value of all enum values

I want to assign all default values for allowed_file_types column in products table which are all values of enum FileTypes. But now I have no way to do that.

Can you help me?

This is my file FileTypes:

<?php

namespace App\Enums;

use BenSampo\Enum\Enum;

/**
 * @method static static OptionOne()
 * @method static static OptionTwo()
 * @method static static OptionThree()
 */
final class FileTypes extends Enum
{
    const JPG =   'jpg';
    const PNG =   'ps';
    const AI = 'ai';
    const PS = 'ps';
    const PDF = 'psd';
    const BMP = 'bmp';
    const IDDD = 'iddd';
}

This is my file Migration:

 <?php
    
    use App\Enums\FileTypes;
    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    class AddFielsToProductsTable extends Migration
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::table('products', function (Blueprint $table) {
                $table->enum('allowed_file_types', ['jpg', 'png', 'ai', 'ps', 'pdf', 'bmp', 'iddd'])->default(FileTypes::);
                $table->integer('max_file_upload');
                $table->integer('min_jpg_dpi');
            });
        }
    
        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::table('products', function (Blueprint $table) {
                $table->dropColumn('allowed_file_types');
                $table->dropColumn('max_file_upload');
                $table->dropColumn('min_jpg_dpi');
            });
        }
    }


Solution 1:[1]

As far as I'm aware you can only set the default value to be one of the allowed strings. So you'd need to just pick one to be the default.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Scott Dunn