increments('id')->comment('购物车项ID'); $table->integer('user_id')->comment('用户ID(购物车归属者)'); $table->integer('product_id')->comment('商品ID'); $table->decimal('quantity', 10, 2)->default(0)->comment('订货量'); $table->timestamps(); $table->unique(['user_id', 'product_id'], 'cart_user_product_unique'); $table->index(['user_id', 'created_at'], 'cart_user_created_index'); $table->comment('小程序购物车表(门店订货车)'); }); } } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('cart'); } };