Passed
Push — develop ( a95732...cd40df )
by Septianata
12:51
created

anonymous//database/migrations/2021_05_22_000008_create_customers_table.php$0   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 19
c 0
b 0
f 0
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A 2021_05_22_000008_create_customers_table.php$0 ➔ down() 0 3 1
A 2021_05_22_000008_create_customers_table.php$0 ➔ up() 0 20 1
1
<?php
2
3
use App\Enum\Gender;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Support\Facades\Schema;
7
8
/**
9
 * @see \App\Models\Customer
10
 */
11
return new class extends Migration
12
{
13
    /**
14
     * Run the migrations.
15
     *
16
     * @return void
17
     */
18
    public function up()
19
    {
20
        Schema::create('customers', function (Blueprint $table) {
21
            $table->id();
22
23
            $table->string('telegram_chat_id');
24
            $table->string('username');
25
            $table->string('fullname');
26
            $table->string('gender')->default(Gender::undefined());
27
            $table->string('email')->unique();
28
            $table->string('phone_country')->default(env('PHONE_COUNTRY', 'ID'));
29
            $table->string('phone')->unique();
30
            $table->string('whatsapp_phone_country')->default(env('PHONE_COUNTRY', 'ID'));
31
            $table->string('whatsapp_phone')->unique();
32
            $table->string('account_number')->nullable()->comment('nomor rekening bank');
33
            $table->string('identitycard_number')->nullable()->comment('nomor ktp');
34
            $table->string('identitycard_image')->nullable()->comment('foto ktp');
35
            $table->string('location_latitude')->nullable();
36
            $table->string('location_longitude')->nullable();
37
            $table->timestamps();
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     *
44
     * @return void
45
     */
46
    public function down()
47
    {
48
        Schema::dropIfExists('customers');
49
    }
50
};
51