@@ -5,90 +5,90 @@ |
||
5 | 5 | |
6 | 6 | $factory->define(Account::class, function (Faker $faker) { |
7 | 7 | return [ |
8 | - 'user_id' => 1, |
|
9 | - 'username' => $faker->unique()->safeEmail, |
|
10 | - 'password' => $faker->password, |
|
11 | - 'game' => 'OSRS', |
|
12 | - 'banned_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->subHours($faker->numberBetween(1, 500)), |
|
13 | - 'last_heartbeat_at' => $faker->boolean(50) ? null : \Carbon\Carbon::now()->subSeconds($faker->numberBetween(1, 500)), |
|
14 | - 'performance_mode' => array_random([ |
|
15 | - 'EXTREME', |
|
16 | - 'MEDIUM', |
|
17 | - 'DISABLED', |
|
18 | - ]), |
|
19 | - 'logged_in' => $faker->boolean, |
|
20 | - 'machine_id' => 1, |
|
21 | - ]; |
|
8 | + 'user_id' => 1, |
|
9 | + 'username' => $faker->unique()->safeEmail, |
|
10 | + 'password' => $faker->password, |
|
11 | + 'game' => 'OSRS', |
|
12 | + 'banned_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->subHours($faker->numberBetween(1, 500)), |
|
13 | + 'last_heartbeat_at' => $faker->boolean(50) ? null : \Carbon\Carbon::now()->subSeconds($faker->numberBetween(1, 500)), |
|
14 | + 'performance_mode' => array_random([ |
|
15 | + 'EXTREME', |
|
16 | + 'MEDIUM', |
|
17 | + 'DISABLED', |
|
18 | + ]), |
|
19 | + 'logged_in' => $faker->boolean, |
|
20 | + 'machine_id' => 1, |
|
21 | + ]; |
|
22 | 22 | }); |
23 | 23 | |
24 | - $factory->state(Account::class, 'OSRS', function (Faker $faker) { |
|
25 | - return [ |
|
26 | - 'game' => 'OSRS', |
|
27 | - 'bank_pin' => $faker->randomNumber(4, true), |
|
28 | - 'ingame_name' => $faker->userName, |
|
29 | - 'membership_expires_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->addHours($faker->numberBetween(1, 500)), |
|
30 | - 'location' => [ |
|
31 | - 'x' => $faker->numberBetween(-10000, 10000), |
|
32 | - 'y' => $faker->numberBetween(-10000, 10000), |
|
33 | - 'z' => $faker->numberBetween(0, 3), |
|
34 | - ], |
|
35 | - 'skills' => [ |
|
36 | - 'hitpoints' => $faker->numberBetween(0, 200000000), |
|
37 | - 'attack' => $faker->numberBetween(0, 200000000), |
|
38 | - 'strength' => $faker->numberBetween(0, 200000000), |
|
39 | - 'defence' => $faker->numberBetween(0, 200000000), |
|
40 | - 'ranged' => $faker->numberBetween(0, 200000000), |
|
41 | - 'prayer' => $faker->numberBetween(0, 200000000), |
|
42 | - 'magic' => $faker->numberBetween(0, 200000000), |
|
43 | - 'runecrafting' => $faker->numberBetween(0, 200000000), |
|
44 | - 'crafting' => $faker->numberBetween(0, 200000000), |
|
45 | - 'mining' => $faker->numberBetween(0, 200000000), |
|
46 | - 'smithing' => $faker->numberBetween(0, 200000000), |
|
47 | - 'fishing' => $faker->numberBetween(0, 200000000), |
|
48 | - 'cooking' => $faker->numberBetween(0, 200000000), |
|
49 | - 'firemaking' => $faker->numberBetween(0, 200000000), |
|
50 | - 'woodcutting' => $faker->numberBetween(0, 200000000), |
|
51 | - 'agility' => $faker->numberBetween(0, 200000000), |
|
52 | - 'herblore' => $faker->numberBetween(0, 200000000), |
|
53 | - 'thieving' => $faker->numberBetween(0, 200000000), |
|
54 | - 'fletching' => $faker->numberBetween(0, 200000000), |
|
55 | - 'slayer' => $faker->numberBetween(0, 200000000), |
|
56 | - 'farming' => $faker->numberBetween(0, 200000000), |
|
57 | - 'construction' => $faker->numberBetween(0, 200000000), |
|
58 | - 'hunter' => $faker->numberBetween(0, 200000000), |
|
59 | - ], |
|
60 | - 'items' => [ |
|
61 | - 'bank' => [ |
|
62 | - [ |
|
63 | - 'item_id' => 5, |
|
64 | - 'amount' => 2, |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'item_id' => 4, |
|
68 | - 'amount' => 3, |
|
69 | - ], |
|
70 | - [ |
|
71 | - 'item_id' => 2, |
|
72 | - 'amount' => 1, |
|
73 | - ], |
|
74 | - ], |
|
75 | - 'equipment' => [], |
|
76 | - 'grand_exchange' => [ |
|
77 | - [ |
|
78 | - 'item_id' => 5, |
|
79 | - 'amount' => 2, |
|
80 | - ], |
|
81 | - ], |
|
82 | - 'inventory' => [], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - }); |
|
24 | + $factory->state(Account::class, 'OSRS', function (Faker $faker) { |
|
25 | + return [ |
|
26 | + 'game' => 'OSRS', |
|
27 | + 'bank_pin' => $faker->randomNumber(4, true), |
|
28 | + 'ingame_name' => $faker->userName, |
|
29 | + 'membership_expires_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->addHours($faker->numberBetween(1, 500)), |
|
30 | + 'location' => [ |
|
31 | + 'x' => $faker->numberBetween(-10000, 10000), |
|
32 | + 'y' => $faker->numberBetween(-10000, 10000), |
|
33 | + 'z' => $faker->numberBetween(0, 3), |
|
34 | + ], |
|
35 | + 'skills' => [ |
|
36 | + 'hitpoints' => $faker->numberBetween(0, 200000000), |
|
37 | + 'attack' => $faker->numberBetween(0, 200000000), |
|
38 | + 'strength' => $faker->numberBetween(0, 200000000), |
|
39 | + 'defence' => $faker->numberBetween(0, 200000000), |
|
40 | + 'ranged' => $faker->numberBetween(0, 200000000), |
|
41 | + 'prayer' => $faker->numberBetween(0, 200000000), |
|
42 | + 'magic' => $faker->numberBetween(0, 200000000), |
|
43 | + 'runecrafting' => $faker->numberBetween(0, 200000000), |
|
44 | + 'crafting' => $faker->numberBetween(0, 200000000), |
|
45 | + 'mining' => $faker->numberBetween(0, 200000000), |
|
46 | + 'smithing' => $faker->numberBetween(0, 200000000), |
|
47 | + 'fishing' => $faker->numberBetween(0, 200000000), |
|
48 | + 'cooking' => $faker->numberBetween(0, 200000000), |
|
49 | + 'firemaking' => $faker->numberBetween(0, 200000000), |
|
50 | + 'woodcutting' => $faker->numberBetween(0, 200000000), |
|
51 | + 'agility' => $faker->numberBetween(0, 200000000), |
|
52 | + 'herblore' => $faker->numberBetween(0, 200000000), |
|
53 | + 'thieving' => $faker->numberBetween(0, 200000000), |
|
54 | + 'fletching' => $faker->numberBetween(0, 200000000), |
|
55 | + 'slayer' => $faker->numberBetween(0, 200000000), |
|
56 | + 'farming' => $faker->numberBetween(0, 200000000), |
|
57 | + 'construction' => $faker->numberBetween(0, 200000000), |
|
58 | + 'hunter' => $faker->numberBetween(0, 200000000), |
|
59 | + ], |
|
60 | + 'items' => [ |
|
61 | + 'bank' => [ |
|
62 | + [ |
|
63 | + 'item_id' => 5, |
|
64 | + 'amount' => 2, |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'item_id' => 4, |
|
68 | + 'amount' => 3, |
|
69 | + ], |
|
70 | + [ |
|
71 | + 'item_id' => 2, |
|
72 | + 'amount' => 1, |
|
73 | + ], |
|
74 | + ], |
|
75 | + 'equipment' => [], |
|
76 | + 'grand_exchange' => [ |
|
77 | + [ |
|
78 | + 'item_id' => 5, |
|
79 | + 'amount' => 2, |
|
80 | + ], |
|
81 | + ], |
|
82 | + 'inventory' => [], |
|
83 | + ], |
|
84 | + ]; |
|
85 | + }); |
|
86 | 86 | |
87 | - $factory->state(Account::class, 'RS3', function (Faker $faker) { |
|
88 | - return [ |
|
89 | - 'game' => 'RS3', |
|
90 | - 'bank_pin' => $faker->randomNumber(4, true), |
|
91 | - 'ingame_name' => $faker->userName, |
|
92 | - 'membership_expires_at' => null, |
|
93 | - ]; |
|
94 | - }); |
|
87 | + $factory->state(Account::class, 'RS3', function (Faker $faker) { |
|
88 | + return [ |
|
89 | + 'game' => 'RS3', |
|
90 | + 'bank_pin' => $faker->randomNumber(4, true), |
|
91 | + 'ingame_name' => $faker->userName, |
|
92 | + 'membership_expires_at' => null, |
|
93 | + ]; |
|
94 | + }); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Faker\Generator as Faker; |
4 | 4 | use Modules\Account\Entities\Account; |
5 | 5 | |
6 | -$factory->define(Account::class, function (Faker $faker) { |
|
6 | +$factory->define(Account::class, function(Faker $faker) { |
|
7 | 7 | return [ |
8 | 8 | 'user_id' => 1, |
9 | 9 | 'username' => $faker->unique()->safeEmail, |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | ]; |
22 | 22 | }); |
23 | 23 | |
24 | - $factory->state(Account::class, 'OSRS', function (Faker $faker) { |
|
24 | + $factory->state(Account::class, 'OSRS', function(Faker $faker) { |
|
25 | 25 | return [ |
26 | 26 | 'game' => 'OSRS', |
27 | 27 | 'bank_pin' => $faker->randomNumber(4, true), |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | 'amount' => 1, |
73 | 73 | ], |
74 | 74 | ], |
75 | - 'equipment' => [], |
|
75 | + 'equipment' => [ ], |
|
76 | 76 | 'grand_exchange' => [ |
77 | 77 | [ |
78 | 78 | 'item_id' => 5, |
79 | 79 | 'amount' => 2, |
80 | 80 | ], |
81 | 81 | ], |
82 | - 'inventory' => [], |
|
82 | + 'inventory' => [ ], |
|
83 | 83 | ], |
84 | 84 | ]; |
85 | 85 | }); |
86 | 86 | |
87 | - $factory->state(Account::class, 'RS3', function (Faker $faker) { |
|
87 | + $factory->state(Account::class, 'RS3', function(Faker $faker) { |
|
88 | 88 | return [ |
89 | 89 | 'game' => 'RS3', |
90 | 90 | 'bank_pin' => $faker->randomNumber(4, true), |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function __construct($user) |
64 | 64 | { |
65 | 65 | $this->user = $user; |
66 | - parent::__construct([]); |
|
66 | + parent::__construct([ ]); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | public function toArray($request) |
77 | 77 | { |
78 | - return []; |
|
78 | + return [ ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function transformUser(MachineTestModel $machine) |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | |
87 | 87 | class UserIncludedMachineTestTransformer extends MachineTestTransformer |
88 | 88 | { |
89 | - public $include = ['user']; |
|
89 | + public $include = [ 'user' ]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | class UserTestTransformer extends Transformer |
93 | 93 | { |
94 | 94 | public function toArray($request) |
95 | 95 | { |
96 | - return []; |
|
96 | + return [ ]; |
|
97 | 97 | } |
98 | 98 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'production' => [ |
75 | 75 | 'supervisor-1' => [ |
76 | 76 | 'connection' => 'redis', |
77 | - 'queue' => ['default'], |
|
77 | + 'queue' => [ 'default' ], |
|
78 | 78 | 'balance' => 'simple', |
79 | 79 | 'processes' => 10, |
80 | 80 | 'tries' => 3, |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'local' => [ |
85 | 85 | 'supervisor-1' => [ |
86 | 86 | 'connection' => 'redis', |
87 | - 'queue' => ['default'], |
|
87 | + 'queue' => [ 'default' ], |
|
88 | 88 | 'balance' => 'simple', |
89 | 89 | 'processes' => 3, |
90 | 90 | 'tries' => 3, |
@@ -30,10 +30,10 @@ |
||
30 | 30 | protected $middlewareGroups = [ |
31 | 31 | 'web' => [ |
32 | 32 | //\Foundation\Middleware\EncryptCookies::class, |
33 | - //\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
34 | - //\Illuminate\Session\Middleware\StartSession::class, |
|
35 | - //\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
36 | - //\Foundation\Middleware\VerifyCsrfToken::class, |
|
33 | + //\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
34 | + //\Illuminate\Session\Middleware\StartSession::class, |
|
35 | + //\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
36 | + //\Foundation\Middleware\VerifyCsrfToken::class, |
|
37 | 37 | //\Illuminate\Routing\Middleware\SubstituteBindings::class, |
38 | 38 | ], |
39 | 39 |
@@ -37,15 +37,15 @@ |
||
37 | 37 | $tokenInfo = $auth0->decodeJWT($accessToken); |
38 | 38 | $user = $this->auth0Service->getUserByDecodedJWT($tokenInfo); |
39 | 39 | |
40 | - if (! $user) { |
|
41 | - return response()->json(['error' => 'Unauthorized user.'], 401); |
|
40 | + if (!$user) { |
|
41 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | \Auth::login($user); |
45 | 45 | } catch (InvalidTokenException $e) { |
46 | - return response()->json(['error' => 'Invalid or no token set.'], 401); |
|
46 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401); |
|
47 | 47 | } catch (CoreException $e) { |
48 | - return response()->json(['error' => $e->getMessage()], 401); |
|
48 | + return response()->json([ 'error' => $e->getMessage() ], 401); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $next($request); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->loadServices(); |
78 | 78 | |
79 | - if (! $this->validator->validate($this->profile)) { |
|
79 | + if (!$this->validator->validate($this->profile)) { |
|
80 | 80 | throw new UnauthorizedException('Invalid profile data found in the access token'); |
81 | 81 | } |
82 | 82 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $profile = $this->transformer->transformProfile($this->profile); |
112 | 112 | |
113 | 113 | if ($this->profileHasChanged()) { |
114 | - $profile['provider'] = $this->identityProvider; |
|
114 | + $profile[ 'provider' ] = $this->identityProvider; |
|
115 | 115 | $this->user->fill($profile); |
116 | 116 | $this->user->save(); |
117 | 117 | } |
@@ -124,6 +124,6 @@ discard block |
||
124 | 124 | $user = $this->user->toArray(); |
125 | 125 | $profile = (array) $this->profile; |
126 | 126 | |
127 | - return ! array_is_subset_of($profile, $user); |
|
127 | + return !array_is_subset_of($profile, $user); |
|
128 | 128 | } |
129 | 129 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - if (! isset($this->collection) || $this->collection === '') { |
|
30 | + if (!isset($this->collection) || $this->collection === '') { |
|
31 | 31 | throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
32 | 32 | } |
33 | 33 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | final public function up() |
41 | 41 | { |
42 | - if (! Schema::connection($this->connection)->hasTable($this->collection)) { |
|
43 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
42 | + if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
|
43 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
44 | 44 | if (method_exists($this, 'migrate')) { |
45 | 45 | $this->migrate($collection); |
46 | 46 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function cache(): ModelCache |
25 | 25 | { |
26 | - if (! isset(static::$caching)) { |
|
26 | + if (!isset(static::$caching)) { |
|
27 | 27 | static::$caching = new ModelCache(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime')); |
28 | 28 | } |
29 | 29 | |
30 | 30 | return static::$caching; |
31 | 31 | } |
32 | 32 | |
33 | - public static function find($id, $columns = ['*']) |
|
33 | + public static function find($id, $columns = [ '*' ]) |
|
34 | 34 | { |
35 | 35 | if (static::cache()->enabled()) { |
36 | 36 | $model = static::cache()->find($id) ?? static::recache($id); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $model; |
50 | 50 | } |
51 | 51 | |
52 | - public static function findWithoutCache($id, $columns = ['*']) |
|
52 | + public static function findWithoutCache($id, $columns = [ '*' ]) |
|
53 | 53 | { |
54 | 54 | $model = new static(); |
55 | 55 | if (is_array($id) || $id instanceof Arrayable) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | - if ($columns !== ['*']) { |
|
68 | + if ($columns !== [ '*' ]) { |
|
69 | 69 | return collect($model)->first($columns); |
70 | 70 | } |
71 | 71 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() |
25 | 25 | { |
26 | - if (! isset($this->collection) || $this->collection === '') { |
|
26 | + if (!isset($this->collection) || $this->collection === '') { |
|
27 | 27 | throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
28 | 28 | } |
29 | 29 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | final public function up() |
39 | 39 | { |
40 | - if (! Schema::connection($this->connection)->hasTable($this->collection)) { |
|
41 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
40 | + if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
|
41 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
42 | 42 | $this->migrate($collection); |
43 | 43 | }); |
44 | 44 | } |