Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

auroralabs's avatar

Updating a ENUM field

I have a question regarding the best way to allow an admin user to update the options of a row in a table.

I have a receipts table that uses a emun type to allow users to select a pre-defined option for the status of an item within the warehouse for example Goods Inwards.

Schema::create('receipts', function (Blueprint $table) {
    $table->id();
    $table->string('warehouse');
    $table->string('location');
    $table->string('arrival');
    $table->enum('status', ['Goods Inwards', 'Inside Sales', 'Despatch', 'Inventory Control', 'GI Processing', 'Orders on Hold', 'Quarantine', 'Completed'])->default('Goods Inwards');
    $table->string('po_number');
    $table->string('supplier');
    $table->string('delivery');
    $table->integer('quantity');
    $table->string('consignment');
    $table->integer('comments')->default(0);
    $table->boolean('has_attachments')->default(false);
    $table->timestamps();
});

In filament rather than creating a seperate table ie ReceiptsStatus to store the values and disply using a ReceiptsStatusResourse for example is it possible for an admin user to add new statuses into the enun row via the dashboard.

A ReceiptsResourse would already be in use for users to create a Receipt and update Status etc...

0 likes
2 replies
martinbean's avatar
Level 80

is it possible for an admin user to add new statuses into the enun row via the dashboard.

@auroralabs No. It’s not possible for any one to add new cases to an enum column. You cannot change enum columns; you need to drop them and re-create them to change cases (and update any rows referencing removed cases).

For this reason, it’s always better to just use a varchar column or create a look-up table. I’d create a look-up table, especially if you want people to be changing the values via an admin panel. That’s data.

Users using an admin panel should not be modifying your database’s schema, which adding/removing enum cases would be. If they’re adding/removing cases, then your schema is no longer going to be reflective of your migrations as the cases will have changed since you created the column via migrations.

3 likes
auroralabs's avatar

@martinbean Thanks for that. Yeah I was wondering about the migrations as I would expect the inventory database to change over time when new options and features are added.

Please or to participate in this conversation.