@@ -8,8 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | public function up() |
10 | 10 | { |
11 | - Capsule::schema()->create('users', function($table) |
|
12 | - { |
|
11 | + Capsule::schema()->create('users', function($table) { |
|
13 | 12 | $table->increments('id'); |
14 | 13 | $table->string('email')->unique(); |
15 | 14 | $table->string('full_name'); |
@@ -8,8 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | public function up() |
10 | 10 | { |
11 | - Capsule::schema()->create('logs', function($table) |
|
12 | - { |
|
11 | + Capsule::schema()->create('logs', function($table) { |
|
13 | 12 | $table->increments('id'); |
14 | 13 | $table->string('action'); |
15 | 14 | $table->morphs('entity'); |
@@ -8,8 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | public function up() |
10 | 10 | { |
11 | - Capsule::schema()->create('roles_to_rights', function($table) |
|
12 | - { |
|
11 | + Capsule::schema()->create('roles_to_rights', function($table) { |
|
13 | 12 | $table->integer('role_id')->unsigned(); |
14 | 13 | $table->integer('right_id')->unsigned(); |
15 | 14 | $table->primary(['role_id', 'right_id']); |
@@ -51,8 +51,7 @@ |
||
51 | 51 | $i = 1; |
52 | 52 | $token = ''; |
53 | 53 | |
54 | - while ($i <= $length) |
|
55 | - { |
|
54 | + while ($i <= $length) { |
|
56 | 55 | $num = rand() % $charsCount; |
57 | 56 | $tmp = substr($chars, $num, 1); |
58 | 57 | $token .= $tmp; |
@@ -66,11 +66,13 @@ |
||
66 | 66 | return $this->hasOne('App\Model\Role', 'id', 'role_id'); |
67 | 67 | } |
68 | 68 | |
69 | - public function access_tokens(){ |
|
69 | + public function access_tokens() |
|
70 | + { |
|
70 | 71 | return $this->hasMany('App\Model\AccessToken', 'user_id', 'id'); |
71 | 72 | } |
72 | 73 | |
73 | - public function refresh_tokens(){ |
|
74 | + public function refresh_tokens() |
|
75 | + { |
|
74 | 76 | return $this->hasMany('App\Model\RefreshToken', 'user_id', 'id'); |
75 | 77 | } |
76 | 78 |
@@ -24,7 +24,8 @@ |
||
24 | 24 | |
25 | 25 | public $timestamps = false; |
26 | 26 | |
27 | - public function user(){ |
|
27 | + public function user() |
|
28 | + { |
|
28 | 29 | return $this->belongsTo('App\Model\User'); |
29 | 30 | } |
30 | 31 |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | public $timestamps = false; |
26 | 26 | |
27 | - public function user(){ |
|
27 | + public function user() |
|
28 | + { |
|
28 | 29 | return $this->belongsTo('App\Model\User'); |
29 | 30 | } |
30 | 31 | |
@@ -56,7 +57,7 @@ discard block |
||
56 | 57 | try { |
57 | 58 | $payload = JWT::decode($token, getenv('SECRET_KEY'), ['HS256']); |
58 | 59 | return in_array($payload->aud, $whiteList); |
59 | - } catch (\Exception $e){ |
|
60 | + } catch (\Exception $e) { |
|
60 | 61 | return false; |
61 | 62 | } |
62 | 63 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | use Illuminate\Database\Capsule\Manager as Capsule; |
3 | 3 | |
4 | -class CreateAccessTokensTable{ |
|
4 | +class CreateAccessTokensTable |
|
5 | +{ |
|
5 | 6 | /** |
6 | 7 | * Do the migration |
7 | 8 | */ |
8 | 9 | public function up() |
9 | 10 | { |
10 | - Capsule::schema()->create('access_tokens', function($table) |
|
11 | - { |
|
11 | + Capsule::schema()->create('access_tokens', function($table) { |
|
12 | 12 | $table->increments('id'); |
13 | 13 | $table->integer('user_id')->unsigned()->index(); |
14 | 14 | $table->string('access_token')->unique()->nullable(); |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | use Illuminate\Database\Capsule\Manager as Capsule; |
3 | 3 | |
4 | -class CreateRefreshTokensTable{ |
|
4 | +class CreateRefreshTokensTable |
|
5 | +{ |
|
5 | 6 | /** |
6 | 7 | * Do the migration |
7 | 8 | */ |
8 | 9 | public function up() |
9 | 10 | { |
10 | - Capsule::schema()->create('refresh_tokens', function($table) |
|
11 | - { |
|
11 | + Capsule::schema()->create('refresh_tokens', function($table) { |
|
12 | 12 | $table->increments('id'); |
13 | 13 | $table->integer('user_id')->unsigned()->index(); |
14 | 14 | $table->string('refresh_token')->unique()->nullable(); |