CodeBooster
Get the kit free

Inside a module

Read the code before you buy it.

58 files the generator wrote from one migration — the Product example module exactly as it ships in v2.9.0. Not shown: its 2 language files and the lines it adds to 7 shared ones, such as the routes, sidebar and permissions.

database/migrations/2026_10_22_200000_create_shop_catalog_tables.php 94 lines · comments trimmed
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->id();
            $table->string('name', 40)->unique()->comment('searchable;display;creatable');
            $table->timestamps();
        });

        Schema::create('categories', function (Blueprint $table) {
            $table->id();
            $table->foreignId('parent_id')->nullable()->comment('tree;label:Parent category')
                ->constrained('categories')->restrictOnDelete();
            $table->string('level', 12)->comment('derived;filter;enum:department,category');
            $table->string('name', 80)->comment('searchable;display');
            $table->string('slug', 100)->unique();
            $table->text('description')->nullable();
            $table->boolean('is_active')->default(true)->comment('filter');
            $table->timestamps();
            $table->softDeletes();

            $table->index('parent_id');
            $table->index('name');
        });

        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->foreignId('category_id')->comment('filter;cascade:level=category')->constrained()->restrictOnDelete();
            $table->string('name', 120)->comment('searchable;display');
            $table->string('slug', 140)->unique()->comment('slug');
            $table->string('sku', 32)->unique()->comment('searchable;immutable;label:SKU');
            $table->string('status', 20)->default('draft')
                ->comment('filter;tabs;enum:draft,active,archived;tone:draft=neutral,active=success,archived=settled');
            $table->decimal('price', 10, 2)->comment('filter;restricted;section:Pricing');
            $table->decimal('compare_at_price', 10, 2)->nullable()->comment('collapse;label:Compare-at price');
            $table->decimal('cost_price', 10, 2)->nullable()->comment('private');
            $table->jsonb('photos')->nullable()->comment('image;multiple;variants;section:Presentation');
            $table->string('video_url', 500)->nullable()->comment('embed;label:Video');
            $table->text('description')->nullable()->comment('richtext');
            $table->string('size_chart')->nullable()->comment('file;label:Size chart');
            $table->boolean('is_featured')->default(false)->comment('filter');
            $table->timestamp('published_at')->nullable()->comment('stamp:status=active;label:Published');
            $table->foreignId('published_by')->nullable()->constrained('users')->nullOnDelete();
            $table->timestamps();
            $table->softDeletes();

            $table->index('category_id');
            $table->index('published_by');
            $table->index('name');
            $table->index('status');
            $table->index('price');
        });

        Schema::create('product_tag', function (Blueprint $table) {
            $table->id();
            $table->foreignId('product_id')->constrained()->cascadeOnDelete();
            $table->foreignId('tag_id')->constrained()->cascadeOnDelete();
            $table->unique(['product_id', 'tag_id']);
            $table->index('tag_id');
        });

        Schema::create('product_variants', function (Blueprint $table) {
            $table->id();
            $table->foreignId('product_id')->comment('filter;panel')->constrained()->cascadeOnDelete();
            $table->string('name', 100)->comment('searchable;display;label:Variant');
            $table->string('sku', 40)->unique()->comment('searchable;immutable;label:SKU;regex:/^[A-Z0-9-]+$/');
            $table->string('size', 4)->default('m')->comment('filter;enum:xs=XS,s=S,m=M,l=L,xl=XL;unique:product_id,color');
            $table->string('color', 7)->nullable()->comment('color');
            $table->decimal('price', 10, 2)->nullable()->comment('label:Price override');
            $table->integer('stock')->default(0)->comment('filter;validate:min:0');
            $table->jsonb('measurements')->nullable()->comment('widget:Measurements;no-index;label:Measurements (cm)');
            $table->timestamps();

            $table->index('product_id');
            $table->index('stock');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('product_variants');
        Schema::dropIfExists('product_tag');
        Schema::dropIfExists('products');
        Schema::dropIfExists('categories');
        Schema::dropIfExists('tags');
    }
};