93078/how-can-create-migration-to-add-a-value-to-an-enum-in-eloquent
I have a table that contains an enum field
CREATE TABLE `user_status` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `values` enum('on', 'off'), PRIMARY KEY (`id`), ) ENGINE=InnoDB;
How can I create a migration to add a value to the enum field?
Hello @kartik,
Try using this code:
public function up() { Schema::create('dt_warehouses', function (Blueprint $table) { **$table->enum('isactive', ['Y', 'N'])->default('Y');** $table->timestamps(); }); }
Hope it works!!
Thank You!!
Hello, To create both of the created_at and updated_at columns: $t->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); $t->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update ...READ MORE
Hello @kartik, It's not really Eloquent, to add ...READ MORE
Hello @kartik, You can use : sha1(time()) Explanation: sha1 is ...READ MORE
Hello @kartik, You should create a new migration ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
We need to create a new model ...READ MORE
You need do little modification in your ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.