|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\LaravelTracker\Bases\Migration; |
|
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class CreateTrackerVisitorsTable |
|
8
|
|
|
* |
|
9
|
|
|
* @author ARCANEDEV <[email protected]> |
|
10
|
|
|
*/ |
|
11
|
|
|
class CreateTrackerVisitorsTable extends Migration |
|
12
|
|
|
{ |
|
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
14
|
|
|
| Properties |
|
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
16
|
|
|
*/ |
|
17
|
|
|
/** |
|
18
|
|
|
* The table name. |
|
19
|
|
|
* |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $table = 'visitors'; |
|
23
|
|
|
|
|
24
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
25
|
|
|
| Main Functions |
|
26
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
27
|
|
|
*/ |
|
28
|
|
|
/** |
|
29
|
|
|
* Migrate to database. |
|
30
|
|
|
*/ |
|
31
|
|
|
public function up() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->createSchema(function (Blueprint $table) { |
|
34
|
|
|
$table->bigIncrements('id'); |
|
35
|
|
|
$table->string('uuid')->unique()->index(); |
|
36
|
|
|
$table->bigInteger('user_id', false, true)->nullable()->index(); |
|
37
|
|
|
$table->bigInteger('device_id', false, true)->nullable()->index(); |
|
38
|
|
|
$table->bigInteger('agent_id', false, true)->nullable()->index(); |
|
39
|
|
|
$table->bigInteger('geoip_id', false, true)->nullable()->index(); |
|
40
|
|
|
$table->bigInteger('referer_id', false, true)->nullable()->index(); |
|
41
|
|
|
$table->bigInteger('cookie_id', false, true)->nullable()->index(); |
|
42
|
|
|
$table->bigInteger('language_id', false, true)->nullable()->index(); |
|
43
|
|
|
$table->string('client_ip')->index(); |
|
44
|
|
|
$table->boolean('is_robot')->default(false); |
|
45
|
|
|
$table->timestamp('created_at')->index(); |
|
46
|
|
|
$table->timestamp('updated_at')->index(); |
|
47
|
|
|
}); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|