Issues (16)

config/database/sentinel.php (1 issue)

Labels
Severity
1
<?php
2
3
use Illuminate\Database\Capsule\Manager;
4
use Illuminate\Database\Schema\Blueprint;
5
use Cartalyst\Sentinel\Native\Facades\Sentinel;
6
use Cartalyst\Sentinel\Native\SentinelBootstrapper;
7
8
$sentinel = (new Sentinel(new SentinelBootstrapper(__DIR__.'/../sentinel.php')))->getSentinel();
0 ignored issues
show
__DIR__ . '/../sentinel.php' of type string is incompatible with the type array expected by parameter $config of Cartalyst\Sentinel\Nativ...strapper::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

8
$sentinel = (new Sentinel(new SentinelBootstrapper(/** @scrutinizer ignore-type */ __DIR__.'/../sentinel.php')))->getSentinel();
Loading history...
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->string('scope', 4000)->nullable();
20
    $table->timestamps();
21
});
22
23
Manager::schema()->create('activations', function (Blueprint $table) {
24
    $table->increments('id');
25
    $table->unsignedInteger('user_id');
26
    $table->string('code');
27
    $table->boolean('completed')->default(0);
28
    $table->timestamp('completed_at')->nullable();
29
    $table->timestamps();
30
    $table->foreign('user_id')->references('id')->on('user');
31
});
32
33
Manager::schema()->create('persistences', function (Blueprint $table) {
34
    $table->increments('id');
35
    $table->unsignedInteger('user_id');
36
    $table->string('code')->unique();
37
    $table->timestamps();
38
    $table->foreign('user_id')->references('id')->on('user');
39
});
40
41
Manager::schema()->create('reminders', function (Blueprint $table) {
42
    $table->increments('id');
43
    $table->unsignedInteger('user_id');
44
    $table->string('code');
45
    $table->boolean('completed')->default(0);
46
    $table->timestamp('completed_at')->nullable();
47
    $table->timestamps();
48
    $table->foreign('user_id')->references('id')->on('user');
49
});
50
51
Manager::schema()->create('roles', function (Blueprint $table) {
52
    $table->increments('id');
53
    $table->string('slug')->unique();
54
    $table->string('name');
55
    $table->text('permissions');
56
    $table->timestamps();
57
});
58
59
Manager::schema()->create('role_users', function (Blueprint $table) {
60
    $table->unsignedInteger('user_id');
61
    $table->unsignedInteger('role_id');
62
    $table->timestamps();
63
    $table->primary(['user_id', 'role_id']);
64
    $table->foreign('user_id')->references('id')->on('user');
65
    $table->foreign('role_id')->references('id')->on('roles');
66
});
67
68
Manager::schema()->create('throttle', function (Blueprint $table) {
69
    $table->increments('id');
70
    $table->unsignedInteger('user_id')->nullable();
71
    $table->string('type');
72
    $table->string('ip')->nullable();
73
    $table->timestamps();
74
    $table->foreign('user_id')->references('id')->on('user');
75
});
76
77
$sentinel->getRoleRepository()->createModel()->create([
78
    'name' => 'Admin',
79
    'slug' => 'admin',
80
    'permissions' => [
81
        'user.create' => true,
82
        'user.update' => true,
83
        'user.delete' => true
84
    ]
85
]);
86
87
$sentinel->getRoleRepository()->createModel()->create([
88
    'name' => 'User',
89
    'slug' => 'user',
90
    'permissions' => [
91
        'user.update' => true
92
    ]
93
]);
94