CreateApiLogTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 1
A down() 0 5 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
use Sarahman\HttpRequestApiLog\Helper;
7
8
class CreateApiLogTable extends Migration
9
{
10
    public function up()
11
    {
12
        $config = Helper::getConfig();
13
14
        Schema::connection($config['database_connection'])->create($config['table_name'], function (Blueprint $table) {
15
            $table->bigIncrements('id');
16
            $table->string('client', 50)->index();
17
            $table->string('method', 6);
18
            $table->string('endpoint', 2083)->index();
19
            $table->longText('params');
20
            $table->char('response_code', 3);
21
            $table->longText('response');
22
            $table->timestamps();
23
            $table->index('created_at');
24
        });
25
    }
26
27
    public function down()
28
    {
29
        $config = Helper::getConfig();
30
31
        Schema::connection($config['database_connection'])->dropIfExists($config['table_name']);
32
    }
33
}
34