CodeBooster
Get the kit free

The migration is the configuration.

You describe a field in words. This page tells you the column to write and the hint to leave in its comment — and from those two things the generator decides the input control, the validation rule, the filter, the table format, the export format and the seed value.

How to read this

Every row below is a migration line you can paste. They assume Schema::create('<table>', function (Blueprint $t) { … }) with $t->id() first and $t->timestamps() last — plus $t->softDeletes() when the record should be recoverable from a trash view.

Column names may be English or Indonesian. The semantic vocabulary carries both spellings — name/nama, price/harga, description/deskripsi, a year column ending _year or starting tahun_. The examples here are English because that is the kit's default locale. You lose nothing either way.

Identity & documents

The first three are Indonesian government documents, and their column names stay Indonesian because the documents are: there is no English NPWP.

You ask forMigration columnWhat it buys
NIK / KTP (16 digits)$t->string('nik', 16)->unique()->comment('searchable;mask:nik');Formats as you type, and validates digits:16
NPWP (15 digits)$t->string('npwp', 20)->nullable()->comment('mask:npwp');digits:15
Family card (KK)$t->string('no_kk', 16)->nullable()->comment('mask:kk;label:No. KK');Four-digit groups, digits:16
Student / employee number$t->string('student_number', 20)->unique()->comment('searchable');An identifier people quote out loud
Code / SKU / reference$t->string('sku')->unique()->comment('searchable');Add ;immutable if it must never change after create

Money & numbers

You ask forMigration columnWhat it buys
Price / fee / salary / balance$t->decimal('price', 12, 2)->comment('filter');Currency affix, a range filter, and bounded fake money
Discount / tax (percent)$t->decimal('discount', 5, 2)->nullable()->comment('mask:percent');A % suffix, separators that follow the locale
Stock / quantity$t->integer('stock')->default(0)->comment('filter');Integer input, range filter
Rating (1–5)$t->integer('rating')->nullable()->comment('rating');A star input

Never float or double for money — rounding errors. decimal(12,2) holds up to 9,999,999,999.99.

mask:percent deliberately does not add between:0,100. The column already states its bounds, and a growth figure of 140% is a percentage too. If you do mean 0–100, say so where bounds belong: mask:percent;validate:between:0,100.

Dates & time

You ask forMigration columnWhat it buys
Date of birth$t->date('birth_date')->nullable();A date picker; fake = a DOB 18–60 years ago
A moment (date and time)$t->timestamp('scheduled_at')->nullable();A date-and-time picker
Opening hour (clock only)$t->time('opens_at')->nullable();A native time input
Year$t->integer('founded_year')->nullable();A year picker
Expiry / due date$t->date('expires_at')->nullable()->comment('filter');A date-range filter; fake = a future date

Rule of thumb: date only → date; you need the clock → timestamp; clock only → time.

Contact & address

You ask forMigration columnWhat it buys
Email$t->string('email')->unique()->comment('searchable');E-mail validation from the name alone
Phone$t->string('phone', 20)->nullable()->comment('mask:phone');Formats and validates 9–15 digits server-side
Address$t->text('address')->nullable();A multi-line textarea
City$t->string('city')->nullable()->comment('filter');A filter whose values are searched server-side
Post code$t->string('post_code', 10)->nullable();The length you declare becomes the max: rule

Names & free text

You ask forMigration columnWhat it buys
Name / title$t->string('name')->comment('display;searchable');display = the row's label everywhere: heading, FK picker, audit entry
Description / notes$t->text('description')->nullable();A textarea; fake = a paragraph
Rich content$t->text('content')->nullable()->comment('richtext');A WYSIWYG editor and a safe HTML render
Slug$t->string('slug')->unique();Auto-filled from the display column, and de-duplicated

Exactly one column per table should be display.

Choices — enum or boolean

You ask forMigration columnWhat it buys
Status (a fixed set)$t->string('status')->default('active')->comment('filter;enum:draft,active,inactive');A backed enum, badges, and the status tab strip above the table
A 2–4 option choice$t->string('priority')->default('medium')->comment('enum:low,medium,high;radio');A radio group, every option visible at once
Several fixed tags$t->jsonb('preferences')->nullable()->comment('enum:promo,newsletter,sms;multiple');A checkbox group stored as an array
Yes / no$t->boolean('is_active')->default(true);A switch

Closed set → enum. A list your admins will grow → a lookup table and a foreign key. Order status is an enum; product category is a foreign key.

Files & images

You ask forMigration columnWhat it buys
One image$t->string('photo')->nullable()->comment('image');A file input with a preview; stores the path
A gallery$t->jsonb('gallery')->nullable()->comment('image;multiple');An array of image paths
A document$t->string('document')->nullable()->comment('file');A download link on the detail page
A secret$t->string('password')->comment('password');Hashed, write-only, never shown and never exported

Relationships

When a value is chosen from another table, use a foreign key — never a free-text column. Make sure the referenced table exists and has a display column first.

You ask forMigration columnWhat it buys
Belongs to one$t->foreignId('category_id')->constrained();A picker on the form, and a filter — no hint needed
Optional relation$t->foreignId('courier_id')->nullable()->constrained('couriers');The same, allowed to be empty
A date range$t->date('valid_from'); $t->date('valid_to')->comment('range-end:valid_from');Each end validated against the other
Many-to-manya pivot table with two foreign keys and nothing elseDetected on its own → a checkbox multi-select

Never chain ->comment() onto a ->constrained() foreign key. PostgreSQL silently drops it and static analysis rejects it. A plain foreign key needs no hint at all; when one genuinely does, set it afterwards:

DB::statement("COMMENT ON COLUMN products.courier_id IS 'combobox'");

Visibility & behaviour

Add any of these to a column's comment, combined with ;:

You writeWhat you get
searchableReachable from the search box
filterA filter control, plus a server-side endpoint that searches its values
no-indexHidden from the table, still on the form and detail page
collapseHidden by default, switchable from the column menu
immutableSet once at create, never editable afterwards
no-createFilled in later — absent from the create form
restrictedEditable only by holders of a specific permission
sensitiveMasked on screen, and redacted in the audit log — the key stays, the value does not
label:Any TextA custom field label
validate:min:3|max:50Extra validation rules
show-if:kind=companyShown only when another field has a given value
mask:currencyA money mask while typing in the form, and the very same format in the table cell
transitions:draft>review,review>doneAllowed status moves — any other move is refused, and the detail page gets one button per allowed move
cascade · group · comboboxPicker behaviour on a foreign key: cascading pickers (country → region → city), options grouped under headings, or a searchable combobox — which a table over 100 rows gets on its own

A worked example

Schema::create('products', function (Blueprint $t) {
    $t->id();
    $t->string('name')->comment('display;searchable');
    $t->string('sku')->unique()->comment('searchable;immutable');
    $t->text('description')->nullable();
    $t->foreignId('category_id')->constrained();
    $t->decimal('price', 12, 2)->comment('filter');
    $t->integer('stock')->default(0)->comment('filter');
    $t->string('status')->default('active')
      ->comment('filter;enum:active,sold_out,archived');
    $t->boolean('is_featured')->default(false);
    $t->string('photo')->nullable()->comment('image');
    $t->date('released_on')->nullable()->comment('filter');
    $t->timestamps();
    $t->softDeletes();
});

Then:

php artisan migrate
php artisan make:crud products --as=product --import --api --wire
npm run build

That is a full module — search, filters, a status tab strip, currency formatting, an image kept out of the table, a create and edit form with a foreign-key picker and an upload, a detail page, a trash view, roles and permissions, an activity timeline, a REST API, and a passing test. About sixty files, and the docs page lists every one of them.