1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Cartalyst\Sentinel\Native\Facades\Sentinel; |
4
|
|
|
use Cartalyst\Sentinel\Native\SentinelBootstrapper; |
5
|
|
|
use Illuminate\Database\Capsule\Manager; |
6
|
|
|
use Illuminate\Database\Schema\Blueprint; |
7
|
|
|
|
8
|
|
|
$sentinel = (new Sentinel(new SentinelBootstrapper(__DIR__.'/../sentinel.php')))->getSentinel(); |
|
|
|
|
9
|
|
|
|
10
|
|
|
Manager::schema()->create('user', function (Blueprint $table) { |
11
|
|
|
$table->increments('id'); |
12
|
|
|
$table->string('username')->unique(); |
13
|
|
|
$table->string('email')->unique(); |
14
|
|
|
$table->string('password'); |
15
|
|
|
$table->string('last_name')->nullable(); |
16
|
|
|
$table->string('first_name')->nullable(); |
17
|
|
|
$table->text('permissions'); |
18
|
|
|
$table->timestamp('last_login'); |
19
|
|
|
$table->timestamps(); |
20
|
|
|
}); |
21
|
|
|
|
22
|
|
View Code Duplication |
Manager::schema()->create('activations', function (Blueprint $table) { |
|
|
|
|
23
|
|
|
$table->increments('id'); |
24
|
|
|
$table->unsignedInteger('user_id'); |
25
|
|
|
$table->string('code'); |
26
|
|
|
$table->boolean('completed')->default(0); |
27
|
|
|
$table->timestamp('completed_at')->nullable(); |
28
|
|
|
$table->timestamps(); |
29
|
|
|
$table->foreign('user_id')->references('id')->on('user'); |
|
|
|
|
30
|
|
|
}); |
31
|
|
|
|
32
|
|
|
Manager::schema()->create('persistences', function (Blueprint $table) { |
33
|
|
|
$table->increments('id'); |
34
|
|
|
$table->unsignedInteger('user_id'); |
35
|
|
|
$table->string('code')->unique(); |
36
|
|
|
$table->timestamps(); |
37
|
|
|
$table->foreign('user_id')->references('id')->on('user'); |
|
|
|
|
38
|
|
|
}); |
39
|
|
|
|
40
|
|
View Code Duplication |
Manager::schema()->create('reminders', function (Blueprint $table) { |
|
|
|
|
41
|
|
|
$table->increments('id'); |
42
|
|
|
$table->unsignedInteger('user_id'); |
43
|
|
|
$table->string('code'); |
44
|
|
|
$table->boolean('completed')->default(0); |
45
|
|
|
$table->timestamp('completed_at')->nullable(); |
46
|
|
|
$table->timestamps(); |
47
|
|
|
$table->foreign('user_id')->references('id')->on('user'); |
|
|
|
|
48
|
|
|
}); |
49
|
|
|
|
50
|
|
|
Manager::schema()->create('roles', function (Blueprint $table) { |
51
|
|
|
$table->increments('id'); |
52
|
|
|
$table->string('slug')->unique(); |
53
|
|
|
$table->string('name'); |
54
|
|
|
$table->text('permissions'); |
55
|
|
|
$table->timestamps(); |
56
|
|
|
}); |
57
|
|
|
|
58
|
|
|
Manager::schema()->create('role_users', function (Blueprint $table) { |
59
|
|
|
$table->unsignedInteger('user_id'); |
60
|
|
|
$table->unsignedInteger('role_id'); |
61
|
|
|
$table->timestamps(); |
62
|
|
|
$table->primary(['user_id', 'role_id']); |
63
|
|
|
$table->foreign('user_id')->references('id')->on('user'); |
|
|
|
|
64
|
|
|
$table->foreign('role_id')->references('id')->on('roles'); |
65
|
|
|
}); |
66
|
|
|
|
67
|
|
View Code Duplication |
Manager::schema()->create('throttle', function (Blueprint $table) { |
|
|
|
|
68
|
|
|
$table->increments('id'); |
69
|
|
|
$table->integer('user_id')->unsigned()->nullable(); |
70
|
|
|
$table->string('type'); |
71
|
|
|
$table->string('ip')->nullable(); |
72
|
|
|
$table->timestamps(); |
73
|
|
|
$table->foreign('user_id')->references('id')->on('user'); |
|
|
|
|
74
|
|
|
}); |
75
|
|
|
|
76
|
|
|
$sentinel->getRoleRepository()->createModel()->create([ |
77
|
|
|
'name' => 'Admin', |
78
|
|
|
'slug' => 'admin', |
79
|
|
|
'permissions' => [ |
80
|
|
|
'user.create' => true, |
81
|
|
|
'user.update' => true, |
82
|
|
|
'user.delete' => true |
83
|
|
|
] |
84
|
|
|
]); |
85
|
|
|
|
86
|
|
|
$sentinel->getRoleRepository()->createModel()->create([ |
87
|
|
|
'name' => 'User', |
88
|
|
|
'slug' => 'user', |
89
|
|
|
'permissions' => [ |
90
|
|
|
'user.update' => true |
91
|
|
|
] |
92
|
|
|
]); |
93
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: