38 lines
852 B
PHP
38 lines
852 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('coupons', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('code')->unique();
|
|
$table->enum('type', ['percentage', 'amount']);
|
|
$table->integer('value');
|
|
$table->integer('uses')->default(0);
|
|
$table->integer('max_uses');
|
|
$table->timestamp('expires_at');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('coupons');
|
|
}
|
|
};
|