This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccount/database/migrations/2019_04_17_113702_invite.php

47 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2019-04-24 18:46:41 +00:00
<?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');
}
}