관리-도구
편집 파일: 2020_08_24_171315_create_coupons_table.php
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCouponsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('coupons', function (Blueprint $table) { $table->id(); $table->string('code')->index(); $table->decimal('value', 10, 2)->unsigned()->nullable(); $table->boolean('is_percent'); $table->boolean('free_shipping'); $table->decimal('minimum_spend', 10, 2)->unsigned()->nullable(); $table->decimal('maximum_spend', 10, 2)->unsigned()->nullable(); $table->integer('usage_limit_per_coupon')->unsigned()->nullable(); $table->integer('usage_limit_per_customer')->unsigned()->nullable(); $table->integer('used')->default(0); $table->boolean('is_active'); $table->date('start_date')->nullable(); $table->date('end_date')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('coupons'); } }