|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* CreateVisitorRequestsTable.php |
|
5
|
|
|
* |
|
6
|
|
|
* This migration creates the visitor_requests table. |
|
7
|
|
|
* |
|
8
|
|
|
* PHP version 7.2 |
|
9
|
|
|
* |
|
10
|
|
|
* @category Migrations |
|
11
|
|
|
* @package RedboxTracker |
|
12
|
|
|
* @author Johnny Mast <[email protected]> |
|
13
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
|
14
|
|
|
* @link https://github.com/johnnymast/redbox-tracker |
|
15
|
|
|
* @since GIT:1.0 |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
20
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
21
|
|
|
use Illuminate\Support\Facades\Schema; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class CreateVisitorRequestsTable |
|
25
|
|
|
* |
|
26
|
|
|
* @category Migrations |
|
27
|
|
|
* @package RedboxTracker |
|
28
|
|
|
* @author Johnny Mast <[email protected]> |
|
29
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
|
30
|
|
|
* @link https://github.com/johnnymast/redbox-tracker |
|
31
|
|
|
* @since GIT:1.0 |
|
32
|
|
|
*/ |
|
33
|
|
|
class CreateVisitorRequestsTable extends Migration |
|
34
|
|
|
{ |
|
35
|
|
|
/** |
|
36
|
|
|
* Run the migrations. |
|
37
|
|
|
* |
|
38
|
|
|
* @return void |
|
39
|
|
|
*/ |
|
40
|
|
|
public function up(): void |
|
41
|
|
|
{ |
|
42
|
|
|
Schema::create( |
|
43
|
|
|
'visitor_requests', |
|
44
|
|
|
function (Blueprint $table) { |
|
45
|
|
|
$table->increments('id'); |
|
46
|
|
|
$table->unsignedInteger('visitor_id'); |
|
47
|
|
|
$table->string('domain')->nullable(); |
|
48
|
|
|
$table->string('method')->nullable(); |
|
49
|
|
|
$table->string('path')->nullable(); |
|
50
|
|
|
$table->string('route')->nullable(); |
|
51
|
|
|
$table->string('referer')->nullable(); |
|
52
|
|
|
$table->boolean('is_secure')->default(false); |
|
53
|
|
|
$table->boolean('is_ajax')->default(false); |
|
54
|
|
|
$table->timestamps(); |
|
55
|
|
|
|
|
56
|
|
|
$table->foreign('visitor_id') |
|
57
|
|
|
->references('id') |
|
58
|
|
|
->on('visitors') |
|
59
|
|
|
->onDelete('cascade'); |
|
60
|
|
|
} |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Reverse the migrations. |
|
66
|
|
|
* |
|
67
|
|
|
* @return void |
|
68
|
|
|
*/ |
|
69
|
|
|
public function down(): void |
|
70
|
|
|
{ |
|
71
|
|
|
Schema::dropIfExists('visitor_requests'); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|