47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
|
||
|
class Invite extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
$setting = new \App\Models\Setting();
|
||
|
$setting->name = "invites";
|
||
|
$setting->description = "Enabled Invites";
|
||
|
$setting->typ = "checkbox";
|
||
|
$setting->value = 1;
|
||
|
$setting->saveOrFail();
|
||
|
|
||
|
Schema::create('invites', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->timestamps();
|
||
|
$table->string('username')->nullable()->default(null)->comment("If set the username can't be changed");
|
||
|
$table->string("user_id")->comment("User who create the invite");
|
||
|
$table->string("code")->comment("Invite code");
|
||
|
$table->string("comment")->nullable()->default(null);
|
||
|
$table->enum("status", ["active", "inaktive", "used"])->default("active");
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
$s = \App\Models\Setting::query()->where("name", "=", "invites")->first();
|
||
|
$s->delete();
|
||
|
|
||
|
Schema::drop('invites');
|
||
|
}
|
||
|
}
|