@@ -1,76 +1,76 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Model; |
|
6 | -use Illuminate\Support\Facades\Config; |
|
7 | -use Sofa\Eloquence\Eloquence; |
|
8 | -use Sofa\Eloquence\Mappable; |
|
5 | + use Illuminate\Database\Eloquent\Model; |
|
6 | + use Illuminate\Support\Facades\Config; |
|
7 | + use Sofa\Eloquence\Eloquence; |
|
8 | + use Sofa\Eloquence\Mappable; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Class Room. |
12 | 12 | * |
13 | 13 | * @property int id |
14 | 14 | */ |
15 | -class Room extends Model |
|
16 | -{ |
|
17 | - use Eloquence, Mappable; |
|
15 | + class Room extends Model |
|
16 | + { |
|
17 | + use Eloquence, Mappable; |
|
18 | 18 | |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Disable Timestamps. |
21 | 21 | * |
22 | 22 | * @var bool |
23 | 23 | */ |
24 | - public $timestamps = false; |
|
24 | + public $timestamps = false; |
|
25 | 25 | |
26 | - /** |
|
26 | + /** |
|
27 | 27 | * Leader Board Rank. |
28 | 28 | * |
29 | 29 | * @var int |
30 | 30 | */ |
31 | - public $leaderboardRank = 1; |
|
31 | + public $leaderboardRank = 1; |
|
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * The table associated with the model. |
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | */ |
38 | - protected $table = 'rooms'; |
|
38 | + protected $table = 'rooms'; |
|
39 | 39 | |
40 | - /** |
|
40 | + /** |
|
41 | 41 | * Primary Key of the Table. |
42 | 42 | * |
43 | 43 | * @var string |
44 | 44 | */ |
45 | - protected $primaryKey = 'id'; |
|
45 | + protected $primaryKey = 'id'; |
|
46 | 46 | |
47 | - /** |
|
47 | + /** |
|
48 | 48 | * The attributes that will be mapped. |
49 | 49 | * |
50 | 50 | * @var array |
51 | 51 | */ |
52 | - protected $maps = ['uniqueId' => 'id', 'ownerName' => 'owner_name', 'ownerUniqueId' => 'owner_id', 'doorMode' => 'state', |
|
53 | - 'leaderboardValue' => 'score', 'maximumVisitors' => 'users_max', 'habboGroupId' => 'guild_id', 'rating' => 'score', ]; |
|
52 | + protected $maps = ['uniqueId' => 'id', 'ownerName' => 'owner_name', 'ownerUniqueId' => 'owner_id', 'doorMode' => 'state', |
|
53 | + 'leaderboardValue' => 'score', 'maximumVisitors' => 'users_max', 'habboGroupId' => 'guild_id', 'rating' => 'score', ]; |
|
54 | 54 | |
55 | - /** |
|
55 | + /** |
|
56 | 56 | * The Appender(s) of the Model. |
57 | 57 | * |
58 | 58 | * @var array |
59 | 59 | */ |
60 | - protected $appends = ['uniqueId', 'leaderboardRank', 'thumbnailUrl', 'imageUrl', 'leaderboardValue', 'doorMode', 'maximumVisitors', |
|
61 | - 'publicRoom', 'ownerUniqueId', 'ownerName', 'showOwnerName', 'categories', 'rating', ]; |
|
60 | + protected $appends = ['uniqueId', 'leaderboardRank', 'thumbnailUrl', 'imageUrl', 'leaderboardValue', 'doorMode', 'maximumVisitors', |
|
61 | + 'publicRoom', 'ownerUniqueId', 'ownerName', 'showOwnerName', 'categories', 'rating', ]; |
|
62 | 62 | |
63 | - /** |
|
63 | + /** |
|
64 | 64 | * The attributes excluded from the model's JSON form. |
65 | 65 | * |
66 | 66 | * @var array |
67 | 67 | */ |
68 | - protected $hidden = ['owner_name', 'owner_id', 'is_public', 'state', 'password', 'model', 'users', 'users_max', 'guild_id', 'category', 'score', 'paper_floor', 'paper_wall', |
|
69 | - 'paper_landscape', 'thickness_wall', 'wall_height', 'thickness_floor', 'moodlight_data', 'is_staff_picked', 'allow_other_pets', 'allow_other_pets_eat', 'allow_walkthrough', |
|
70 | - 'allow_hidewall', 'chat_mode', 'chat_weight', 'chat_speed', 'chat_hearing_distance', 'chat_protection', 'override_model', 'who_can_mute', 'who_can_kick', 'who_can_ban', 'poll_id', |
|
71 | - 'roller_speed', 'promoted', 'trade_mode', 'move_diagonally', ]; |
|
68 | + protected $hidden = ['owner_name', 'owner_id', 'is_public', 'state', 'password', 'model', 'users', 'users_max', 'guild_id', 'category', 'score', 'paper_floor', 'paper_wall', |
|
69 | + 'paper_landscape', 'thickness_wall', 'wall_height', 'thickness_floor', 'moodlight_data', 'is_staff_picked', 'allow_other_pets', 'allow_other_pets_eat', 'allow_walkthrough', |
|
70 | + 'allow_hidewall', 'chat_mode', 'chat_weight', 'chat_speed', 'chat_hearing_distance', 'chat_protection', 'override_model', 'who_can_mute', 'who_can_kick', 'who_can_ban', 'poll_id', |
|
71 | + 'roller_speed', 'promoted', 'trade_mode', 'move_diagonally', ]; |
|
72 | 72 | |
73 | - /** |
|
73 | + /** |
|
74 | 74 | * Stores a new Room. |
75 | 75 | * |
76 | 76 | * @param string $roomName |
@@ -86,113 +86,113 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return Room |
88 | 88 | */ |
89 | - public function store(string $roomName, string $description, string $model, int $maxUsers, int $roomCategory, int $floorPaper, int $wallPaper, float $landscapePaper, int $ownerId, string $ownerName) |
|
90 | - { |
|
91 | - $this->attributes['name'] = $roomName; |
|
92 | - $this->attributes['description'] = $description; |
|
93 | - $this->attributes['model'] = $model; |
|
94 | - $this->attributes['users_max'] = $maxUsers; |
|
95 | - $this->attributes['category'] = $roomCategory; |
|
96 | - $this->attributes['paper_floor'] = $floorPaper; |
|
97 | - $this->attributes['paper_wall'] = $wallPaper; |
|
98 | - $this->attributes['paper_landscape'] = $landscapePaper; |
|
99 | - $this->attributes['thickness_wall'] = 0; |
|
100 | - $this->attributes['wall_height'] = -1; |
|
101 | - $this->attributes['thickness_floor'] = 0; |
|
102 | - $this->attributes['owner_id'] = $ownerId; |
|
103 | - $this->attributes['owner_name'] = $ownerName; |
|
104 | - $this->timestamps = false; |
|
105 | - |
|
106 | - $this->save(); |
|
107 | - |
|
108 | - return $this; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
89 | + public function store(string $roomName, string $description, string $model, int $maxUsers, int $roomCategory, int $floorPaper, int $wallPaper, float $landscapePaper, int $ownerId, string $ownerName) |
|
90 | + { |
|
91 | + $this->attributes['name'] = $roomName; |
|
92 | + $this->attributes['description'] = $description; |
|
93 | + $this->attributes['model'] = $model; |
|
94 | + $this->attributes['users_max'] = $maxUsers; |
|
95 | + $this->attributes['category'] = $roomCategory; |
|
96 | + $this->attributes['paper_floor'] = $floorPaper; |
|
97 | + $this->attributes['paper_wall'] = $wallPaper; |
|
98 | + $this->attributes['paper_landscape'] = $landscapePaper; |
|
99 | + $this->attributes['thickness_wall'] = 0; |
|
100 | + $this->attributes['wall_height'] = -1; |
|
101 | + $this->attributes['thickness_floor'] = 0; |
|
102 | + $this->attributes['owner_id'] = $ownerId; |
|
103 | + $this->attributes['owner_name'] = $ownerName; |
|
104 | + $this->timestamps = false; |
|
105 | + |
|
106 | + $this->save(); |
|
107 | + |
|
108 | + return $this; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | 112 | * Get Room Tags. |
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function getTagsAttribute(): array |
|
117 | - { |
|
118 | - return array_filter(explode(';', $this->attributes['tags']), function ($element) { |
|
119 | - return !empty($element); |
|
120 | - }); |
|
121 | - } |
|
116 | + public function getTagsAttribute(): array |
|
117 | + { |
|
118 | + return array_filter(explode(';', $this->attributes['tags']), function ($element) { |
|
119 | + return !empty($element); |
|
120 | + }); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
123 | + /** |
|
124 | 124 | * Get Image Url. |
125 | 125 | * |
126 | 126 | * @TODO: Get Real Full Room Image |
127 | 127 | * |
128 | 128 | * @return string |
129 | 129 | */ |
130 | - public function getImageUrlAttribute(): string |
|
131 | - { |
|
132 | - return "//arcturus.wf/full_{$this->attributes['id']}.png"; |
|
133 | - } |
|
130 | + public function getImageUrlAttribute(): string |
|
131 | + { |
|
132 | + return "//arcturus.wf/full_{$this->attributes['id']}.png"; |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
135 | + /** |
|
136 | 136 | * Get Thumbnail Url. |
137 | 137 | * |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function getThumbnailUrlAttribute(): string |
|
141 | - { |
|
142 | - $userName = Config::get('chocolatey.arcturus'); |
|
140 | + public function getThumbnailUrlAttribute(): string |
|
141 | + { |
|
142 | + $userName = Config::get('chocolatey.arcturus'); |
|
143 | 143 | |
144 | - return "//arcturus.wf/camera/{$userName}/thumbnail_{$this->attributes['id']}.png"; |
|
145 | - } |
|
144 | + return "//arcturus.wf/camera/{$userName}/thumbnail_{$this->attributes['id']}.png"; |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
147 | + /** |
|
148 | 148 | * Return if need show Owner Name. |
149 | 149 | * |
150 | 150 | * @TODO: What this really does? |
151 | 151 | * |
152 | 152 | * @return bool |
153 | 153 | */ |
154 | - public function getShowOwnerNameAttribute(): bool |
|
155 | - { |
|
156 | - return true; |
|
157 | - } |
|
154 | + public function getShowOwnerNameAttribute(): bool |
|
155 | + { |
|
156 | + return true; |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
159 | + /** |
|
160 | 160 | * Set a Leader Board Position. |
161 | 161 | * |
162 | 162 | * @param int $roomPosition |
163 | 163 | */ |
164 | - public function setLeaderBoardRankAttribute(int $roomPosition = 1) |
|
165 | - { |
|
166 | - $this->leaderboardRank = $roomPosition; |
|
167 | - } |
|
164 | + public function setLeaderBoardRankAttribute(int $roomPosition = 1) |
|
165 | + { |
|
166 | + $this->leaderboardRank = $roomPosition; |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
169 | + /** |
|
170 | 170 | * Get Leader Board Rank. |
171 | 171 | * |
172 | 172 | * @return int |
173 | 173 | */ |
174 | - public function getLeaderBoardRankAttribute(): int |
|
175 | - { |
|
176 | - return $this->leaderboardRank; |
|
177 | - } |
|
174 | + public function getLeaderBoardRankAttribute(): int |
|
175 | + { |
|
176 | + return $this->leaderboardRank; |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
179 | + /** |
|
180 | 180 | * Get if the Room is Public. |
181 | 181 | * |
182 | 182 | * @return bool |
183 | 183 | */ |
184 | - public function getPublicRoomAttribute(): bool |
|
185 | - { |
|
186 | - return $this->attributes['is_public'] == 1; |
|
187 | - } |
|
184 | + public function getPublicRoomAttribute(): bool |
|
185 | + { |
|
186 | + return $this->attributes['is_public'] == 1; |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
189 | + /** |
|
190 | 190 | * Get Room Category. |
191 | 191 | * |
192 | 192 | * @return array |
193 | 193 | */ |
194 | - public function getCategoriesAttribute(): array |
|
195 | - { |
|
196 | - return [str_replace('}', '', str_replace('${', '', FlatCat::find($this->attributes['category'])->caption))]; |
|
197 | - } |
|
194 | + public function getCategoriesAttribute(): array |
|
195 | + { |
|
196 | + return [str_replace('}', '', str_replace('${', '', FlatCat::find($this->attributes['category'])->caption))]; |
|
197 | + } |
|
198 | 198 | } |
@@ -1,53 +1,53 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class ArticleCategory. |
7 | 7 | * |
8 | 8 | * @property string name |
9 | 9 | */ |
10 | -class ArticleCategory extends ChocolateyModel |
|
11 | -{ |
|
12 | - /** |
|
10 | + class ArticleCategory extends ChocolateyModel |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * Disable Timestamps. |
14 | 14 | * |
15 | 15 | * @var bool |
16 | 16 | */ |
17 | - public $timestamps = false; |
|
17 | + public $timestamps = false; |
|
18 | 18 | |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Appenders Array. |
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $appends = ['name']; |
|
24 | + protected $appends = ['name']; |
|
25 | 25 | |
26 | - /** |
|
26 | + /** |
|
27 | 27 | * The table associated with the model. |
28 | 28 | * |
29 | 29 | * @var string |
30 | 30 | */ |
31 | - protected $table = 'chocolatey_articles_categories'; |
|
31 | + protected $table = 'chocolatey_articles_categories'; |
|
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Primary Key of the Table. |
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | */ |
38 | - protected $primaryKey = 'link'; |
|
38 | + protected $primaryKey = 'link'; |
|
39 | 39 | |
40 | - /** |
|
40 | + /** |
|
41 | 41 | * Get the Original Link Attribute. |
42 | 42 | * |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - public function getNameAttribute() |
|
46 | - { |
|
47 | - return $this->attributes['link']; |
|
48 | - } |
|
45 | + public function getNameAttribute() |
|
46 | + { |
|
47 | + return $this->attributes['link']; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * Store a New Article Category. |
52 | 52 | * |
53 | 53 | * @param string $link |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return $this |
57 | 57 | */ |
58 | - public function store(string $link, string $translate) |
|
59 | - { |
|
60 | - $this->attributes['link'] = $link; |
|
61 | - $this->attributes['translate'] = $translate; |
|
62 | - $this->timestamps = false; |
|
58 | + public function store(string $link, string $translate) |
|
59 | + { |
|
60 | + $this->attributes['link'] = $link; |
|
61 | + $this->attributes['translate'] = $translate; |
|
62 | + $this->timestamps = false; |
|
63 | 63 | |
64 | - $this->save(); |
|
64 | + $this->save(); |
|
65 | 65 | |
66 | - return $this; |
|
67 | - } |
|
66 | + return $this; |
|
67 | + } |
|
68 | 68 | } |
@@ -1,67 +1,67 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | -use Sofa\Eloquence\Eloquence; |
|
6 | -use Sofa\Eloquence\Mappable; |
|
5 | + use Sofa\Eloquence\Eloquence; |
|
6 | + use Sofa\Eloquence\Mappable; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class PaymentMethod. |
10 | 10 | */ |
11 | -class PaymentMethod extends ChocolateyModel |
|
12 | -{ |
|
13 | - use Eloquence, Mappable; |
|
11 | + class PaymentMethod extends ChocolateyModel |
|
12 | + { |
|
13 | + use Eloquence, Mappable; |
|
14 | 14 | |
15 | - /** |
|
15 | + /** |
|
16 | 16 | * Disable Timestamps. |
17 | 17 | * |
18 | 18 | * @var bool |
19 | 19 | */ |
20 | - public $timestamps = false; |
|
20 | + public $timestamps = false; |
|
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Purchase Params. |
24 | 24 | * |
25 | 25 | * @var PurchaseParam |
26 | 26 | */ |
27 | - public $purchaseParams = null; |
|
27 | + public $purchaseParams = null; |
|
28 | 28 | |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * The table associated with the model. |
31 | 31 | * |
32 | 32 | * @var string |
33 | 33 | */ |
34 | - protected $table = 'chocolatey_shop_payment_methods'; |
|
34 | + protected $table = 'chocolatey_shop_payment_methods'; |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Primary Key of the Table. |
38 | 38 | * |
39 | 39 | * @var string |
40 | 40 | */ |
41 | - protected $primaryKey = 'id'; |
|
41 | + protected $primaryKey = 'id'; |
|
42 | 42 | |
43 | - /** |
|
43 | + /** |
|
44 | 44 | * The Appender(s) of the Model. |
45 | 45 | * |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - protected $appends = ['disclaimerRequired', 'premiumSms', 'purchaseParams', 'requestPath']; |
|
48 | + protected $appends = ['disclaimerRequired', 'premiumSms', 'purchaseParams', 'requestPath']; |
|
49 | 49 | |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * The attributes excluded from the model's JSON form. |
52 | 52 | * |
53 | 53 | * @var array |
54 | 54 | */ |
55 | - protected $hidden = ['disclaimer']; |
|
55 | + protected $hidden = ['disclaimer']; |
|
56 | 56 | |
57 | - /** |
|
57 | + /** |
|
58 | 58 | * The attributes that will be mapped. |
59 | 59 | * |
60 | 60 | * @var array |
61 | 61 | */ |
62 | - protected $maps = ['disclaimerRequired' => 'disclaimer']; |
|
62 | + protected $maps = ['disclaimerRequired' => 'disclaimer']; |
|
63 | 63 | |
64 | - /** |
|
64 | + /** |
|
65 | 65 | * Store an Shop Country. |
66 | 66 | * |
67 | 67 | * @param string $methodName |
@@ -71,76 +71,76 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return PaymentMethod |
73 | 73 | */ |
74 | - public function store(string $methodName, string $code, string $buttonImageUrl, string $buttonText): PaymentMethod |
|
75 | - { |
|
76 | - $this->attributes['name'] = $methodName; |
|
77 | - $this->attributes['buttonLogoUrl'] = $buttonImageUrl; |
|
78 | - $this->attributes['buttonText'] = $buttonText; |
|
79 | - $this->attributes['localizationKey'] = $code; |
|
80 | - $this->timestamps = false; |
|
74 | + public function store(string $methodName, string $code, string $buttonImageUrl, string $buttonText): PaymentMethod |
|
75 | + { |
|
76 | + $this->attributes['name'] = $methodName; |
|
77 | + $this->attributes['buttonLogoUrl'] = $buttonImageUrl; |
|
78 | + $this->attributes['buttonText'] = $buttonText; |
|
79 | + $this->attributes['localizationKey'] = $code; |
|
80 | + $this->timestamps = false; |
|
81 | 81 | |
82 | - $this->save(); |
|
82 | + $this->save(); |
|
83 | 83 | |
84 | - return $this; |
|
85 | - } |
|
84 | + return $this; |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
87 | + /** |
|
88 | 88 | * Get Disclaimer Required Attribute. |
89 | 89 | * |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function getDisclaimerRequiredAttribute(): bool |
|
93 | - { |
|
94 | - return $this->attributes['disclaimer'] == 1; |
|
95 | - } |
|
92 | + public function getDisclaimerRequiredAttribute(): bool |
|
93 | + { |
|
94 | + return $this->attributes['disclaimer'] == 1; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
97 | + /** |
|
98 | 98 | * Get Premium SMS Attribute. |
99 | 99 | * |
100 | 100 | * @return bool |
101 | 101 | */ |
102 | - public function getPremiumSmsAttribute(): bool |
|
103 | - { |
|
104 | - return false; |
|
105 | - } |
|
102 | + public function getPremiumSmsAttribute(): bool |
|
103 | + { |
|
104 | + return false; |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
107 | + /** |
|
108 | 108 | * Get Request Path Attribute. |
109 | 109 | * |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function getRequestPathAttribute(): string |
|
113 | - { |
|
114 | - return 'online'; |
|
115 | - } |
|
112 | + public function getRequestPathAttribute(): string |
|
113 | + { |
|
114 | + return 'online'; |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
117 | + /** |
|
118 | 118 | * Get the Purchase Params. |
119 | 119 | * |
120 | 120 | * @return PurchaseParam |
121 | 121 | */ |
122 | - public function getPurchaseParamsAttribute(): PurchaseParam |
|
123 | - { |
|
124 | - return $this->purchaseParams; |
|
125 | - } |
|
122 | + public function getPurchaseParamsAttribute(): PurchaseParam |
|
123 | + { |
|
124 | + return $this->purchaseParams; |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
127 | + /** |
|
128 | 128 | * Set Purchase Params. |
129 | 129 | * |
130 | 130 | * @param array $parameters |
131 | 131 | */ |
132 | - public function setPurchaseParams(array $parameters) |
|
133 | - { |
|
134 | - $this->purchaseParams = new PurchaseParam($parameters[0], $parameters[1], $this->attributes['id']); |
|
135 | - } |
|
132 | + public function setPurchaseParams(array $parameters) |
|
133 | + { |
|
134 | + $this->purchaseParams = new PurchaseParam($parameters[0], $parameters[1], $this->attributes['id']); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
137 | + /** |
|
138 | 138 | * Get Category Payment Type. |
139 | 139 | * |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - public function getCategoryAttribute(): string |
|
143 | - { |
|
144 | - return PaymentCategory::find($this->attributes['category'])->payment_type; |
|
145 | - } |
|
142 | + public function getCategoryAttribute(): string |
|
143 | + { |
|
144 | + return PaymentCategory::find($this->attributes['category'])->payment_type; |
|
145 | + } |
|
146 | 146 | } |
@@ -1,30 +1,30 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class Permissions. |
7 | 7 | */ |
8 | -class Permissions extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class Permissions extends ChocolateyModel |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Disable Timestamps. |
12 | 12 | * |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - public $timestamps = false; |
|
15 | + public $timestamps = false; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * The table associated with the model. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $table = 'permissions'; |
|
22 | + protected $table = 'permissions'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Primary Key of the Table. |
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $primaryKey = 'id'; |
|
29 | + protected $primaryKey = 'id'; |
|
30 | 30 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | -use Illuminate\Auth\Authenticatable; |
|
6 | -use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; |
|
7 | -use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; |
|
8 | -use Illuminate\Database\Eloquent\Model; |
|
9 | -use Illuminate\Support\Facades\Config; |
|
10 | -use Laravel\Lumen\Auth\Authorizable; |
|
11 | -use Sofa\Eloquence\Eloquence; |
|
12 | -use Sofa\Eloquence\Mappable; |
|
5 | + use Illuminate\Auth\Authenticatable; |
|
6 | + use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; |
|
7 | + use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; |
|
8 | + use Illuminate\Database\Eloquent\Model; |
|
9 | + use Illuminate\Support\Facades\Config; |
|
10 | + use Laravel\Lumen\Auth\Authorizable; |
|
11 | + use Sofa\Eloquence\Eloquence; |
|
12 | + use Sofa\Eloquence\Mappable; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class User. |
@@ -20,77 +20,77 @@ discard block |
||
20 | 20 | * @property string name |
21 | 21 | * @property string motto |
22 | 22 | */ |
23 | -class User extends Model implements AuthenticatableContract, AuthorizableContract |
|
24 | -{ |
|
25 | - use Authenticatable, Authorizable, Eloquence, Mappable; |
|
23 | + class User extends Model implements AuthenticatableContract, AuthorizableContract |
|
24 | + { |
|
25 | + use Authenticatable, Authorizable, Eloquence, Mappable; |
|
26 | 26 | |
27 | - /** |
|
27 | + /** |
|
28 | 28 | * Disable Timestamps. |
29 | 29 | * |
30 | 30 | * @var bool |
31 | 31 | */ |
32 | - public $timestamps = false; |
|
32 | + public $timestamps = false; |
|
33 | 33 | |
34 | - /** |
|
34 | + /** |
|
35 | 35 | * User Traits. |
36 | 36 | * |
37 | 37 | * @var array |
38 | 38 | */ |
39 | - public $traits = ['USER']; |
|
39 | + public $traits = ['USER']; |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * The table associated with the model. |
43 | 43 | * |
44 | 44 | * @var string |
45 | 45 | */ |
46 | - protected $table = 'users'; |
|
46 | + protected $table = 'users'; |
|
47 | 47 | |
48 | - /** |
|
48 | + /** |
|
49 | 49 | * Primary Key of the Table. |
50 | 50 | * |
51 | 51 | * @var string |
52 | 52 | */ |
53 | - protected $primaryKey = 'id'; |
|
53 | + protected $primaryKey = 'id'; |
|
54 | 54 | |
55 | - /** |
|
55 | + /** |
|
56 | 56 | * The attributes that will be mapped. |
57 | 57 | * |
58 | 58 | * @var array |
59 | 59 | */ |
60 | - protected $maps = ['uniqueId' => 'id', 'name' => 'username', 'figureString' => 'look', 'lastWebAccess' => 'last_login', 'creationTime' => 'account_created', 'email' => 'mail', 'identityId' => 'id', 'accountId' => 'id']; |
|
60 | + protected $maps = ['uniqueId' => 'id', 'name' => 'username', 'figureString' => 'look', 'lastWebAccess' => 'last_login', 'creationTime' => 'account_created', 'email' => 'mail', 'identityId' => 'id', 'accountId' => 'id']; |
|
61 | 61 | |
62 | - /** |
|
62 | + /** |
|
63 | 63 | * The Appender(s) of the Model. |
64 | 64 | * |
65 | 65 | * @var array |
66 | 66 | */ |
67 | - protected $appends = ['habboClubMember', 'buildersClubMember', 'sessionLoginId', 'loginLogId', 'identityVerified', 'identityType', 'trusted', 'country', 'traits', |
|
68 | - 'uniqueId', 'name', 'figureString', 'lastWebAccess', 'creationTime', 'email', 'identityId', 'emailVerified', 'accountId', 'memberSince', 'isBanned', 'banDetails', 'isStaff', ]; |
|
67 | + protected $appends = ['habboClubMember', 'buildersClubMember', 'sessionLoginId', 'loginLogId', 'identityVerified', 'identityType', 'trusted', 'country', 'traits', |
|
68 | + 'uniqueId', 'name', 'figureString', 'lastWebAccess', 'creationTime', 'email', 'identityId', 'emailVerified', 'accountId', 'memberSince', 'isBanned', 'banDetails', 'isStaff', ]; |
|
69 | 69 | |
70 | - /** |
|
70 | + /** |
|
71 | 71 | * The attributes that are mass assignable. |
72 | 72 | * |
73 | 73 | * @var array |
74 | 74 | */ |
75 | - protected $fillable = ['mail', 'id', 'username', 'auth_ticket', 'last_login', 'ip_current', 'ip_register', 'mail_verified', 'account_day_of_birth', |
|
76 | - 'real_name', 'look', 'gender', 'credits', 'pixels', 'home_room', ]; |
|
75 | + protected $fillable = ['mail', 'id', 'username', 'auth_ticket', 'last_login', 'ip_current', 'ip_register', 'mail_verified', 'account_day_of_birth', |
|
76 | + 'real_name', 'look', 'gender', 'credits', 'pixels', 'home_room', ]; |
|
77 | 77 | |
78 | - /** |
|
78 | + /** |
|
79 | 79 | * The attributes excluded from the model's JSON form. |
80 | 80 | * |
81 | 81 | * @var array |
82 | 82 | */ |
83 | - protected $hidden = ['id', 'username', 'mail', 'account_created', 'password', 'mail_verified', 'real_name', 'account_day_of_birth', |
|
84 | - 'last_online', 'last_login', 'ip_register', 'auth_ticket', 'home_room', 'points', 'look', 'ip_current', 'online', 'pixels', 'credits', 'gender', 'points', 'rank', ]; |
|
83 | + protected $hidden = ['id', 'username', 'mail', 'account_created', 'password', 'mail_verified', 'real_name', 'account_day_of_birth', |
|
84 | + 'last_online', 'last_login', 'ip_register', 'auth_ticket', 'home_room', 'points', 'look', 'ip_current', 'online', 'pixels', 'credits', 'gender', 'points', 'rank', ]; |
|
85 | 85 | |
86 | - /** |
|
86 | + /** |
|
87 | 87 | * The attributes that should be casted to native types. |
88 | 88 | * |
89 | 89 | * @var array |
90 | 90 | */ |
91 | - protected $casts = ['traits' => 'string']; |
|
91 | + protected $casts = ['traits' => 'string']; |
|
92 | 92 | |
93 | - /** |
|
93 | + /** |
|
94 | 94 | * Store an User on the Database. |
95 | 95 | * |
96 | 96 | * @param string $username |
@@ -100,166 +100,166 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return User |
102 | 102 | */ |
103 | - public function store(string $username, string $email, string $address = '', bool $newUser = true): User |
|
104 | - { |
|
105 | - $this->attributes['username'] = $username; |
|
106 | - $this->attributes['mail'] = $email; |
|
103 | + public function store(string $username, string $email, string $address = '', bool $newUser = true): User |
|
104 | + { |
|
105 | + $this->attributes['username'] = $username; |
|
106 | + $this->attributes['mail'] = $email; |
|
107 | 107 | |
108 | - $this->attributes['motto'] = Config::get('chocolatey.motto'); |
|
109 | - $this->attributes['look'] = Config::get('chocolatey.figure'); |
|
110 | - $this->attributes['auth_ticket'] = ''; |
|
108 | + $this->attributes['motto'] = Config::get('chocolatey.motto'); |
|
109 | + $this->attributes['look'] = Config::get('chocolatey.figure'); |
|
110 | + $this->attributes['auth_ticket'] = ''; |
|
111 | 111 | |
112 | - $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), openssl_random_pseudo_bytes(50)); |
|
113 | - $this->attributes['account_created'] = time(); |
|
112 | + $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), openssl_random_pseudo_bytes(50)); |
|
113 | + $this->attributes['account_created'] = time(); |
|
114 | 114 | |
115 | - $this->attributes['ip_current'] = $address; |
|
115 | + $this->attributes['ip_current'] = $address; |
|
116 | 116 | |
117 | - $this->traits = $newUser ? ['NEW_USER', 'USER'] : ['USER']; |
|
117 | + $this->traits = $newUser ? ['NEW_USER', 'USER'] : ['USER']; |
|
118 | 118 | |
119 | - $this->timestamps = false; |
|
119 | + $this->timestamps = false; |
|
120 | 120 | |
121 | - $this->save(); |
|
122 | - $this->createData(); |
|
121 | + $this->save(); |
|
122 | + $this->createData(); |
|
123 | 123 | |
124 | - return $this; |
|
125 | - } |
|
124 | + return $this; |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
127 | + /** |
|
128 | 128 | * Store an User Alias Set on Database. |
129 | 129 | */ |
130 | - public function createData() |
|
131 | - { |
|
132 | - (new UserPreferences())->store($this->attributes['id']); |
|
133 | - } |
|
130 | + public function createData() |
|
131 | + { |
|
132 | + (new UserPreferences())->store($this->attributes['id']); |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
135 | + /** |
|
136 | 136 | * Get Is User is Banned. |
137 | 137 | * |
138 | 138 | * @return bool |
139 | 139 | */ |
140 | - public function getIsBannedAttribute(): bool |
|
141 | - { |
|
142 | - $ban = Ban::where('user_id', $this->attributes['id'])->first(); |
|
140 | + public function getIsBannedAttribute(): bool |
|
141 | + { |
|
142 | + $ban = Ban::where('user_id', $this->attributes['id'])->first(); |
|
143 | 143 | |
144 | - if ($ban == null) { |
|
145 | - return false; |
|
146 | - } |
|
144 | + if ($ban == null) { |
|
145 | + return false; |
|
146 | + } |
|
147 | 147 | |
148 | - return $ban->ban_expire >= time(); |
|
149 | - } |
|
148 | + return $ban->ban_expire >= time(); |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
151 | + /** |
|
152 | 152 | * Check if Is Staff. |
153 | 153 | * |
154 | 154 | * @return bool |
155 | 155 | */ |
156 | - public function getIsStaffAttribute(): bool |
|
157 | - { |
|
158 | - return array_key_exists('rank', $this->attributes) ? $this->attributes['rank'] >= 5 : false; |
|
159 | - } |
|
156 | + public function getIsStaffAttribute(): bool |
|
157 | + { |
|
158 | + return array_key_exists('rank', $this->attributes) ? $this->attributes['rank'] >= 5 : false; |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
161 | + /** |
|
162 | 162 | * Get Ban Details. |
163 | 163 | * |
164 | 164 | * @return Ban |
165 | 165 | */ |
166 | - public function getBanDetailsAttribute() |
|
167 | - { |
|
168 | - return Ban::where('user_id', $this->attributes['id'])->first(); |
|
169 | - } |
|
166 | + public function getBanDetailsAttribute() |
|
167 | + { |
|
168 | + return Ban::where('user_id', $this->attributes['id'])->first(); |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
171 | + /** |
|
172 | 172 | * Get Current User Country. |
173 | 173 | * |
174 | 174 | * @TODO: Implement this in a proper way |
175 | 175 | * |
176 | 176 | * @return string |
177 | 177 | */ |
178 | - public function getCountryAttribute(): string |
|
179 | - { |
|
180 | - return 'com'; |
|
181 | - } |
|
178 | + public function getCountryAttribute(): string |
|
179 | + { |
|
180 | + return 'com'; |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
183 | + /** |
|
184 | 184 | * Set the Trait Attribute. |
185 | 185 | * |
186 | 186 | * @param array $accountType |
187 | 187 | */ |
188 | - public function setTraitsAttribute(array $accountType) |
|
189 | - { |
|
190 | - $this->traits = $accountType; |
|
191 | - } |
|
188 | + public function setTraitsAttribute(array $accountType) |
|
189 | + { |
|
190 | + $this->traits = $accountType; |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
193 | + /** |
|
194 | 194 | * What is this field? |
195 | 195 | * |
196 | 196 | * @return array |
197 | 197 | */ |
198 | - public function getTraitsAttribute(): array |
|
199 | - { |
|
200 | - if (array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= config('chocolatey.minRank')) { |
|
201 | - return ['STAFF']; |
|
202 | - } |
|
198 | + public function getTraitsAttribute(): array |
|
199 | + { |
|
200 | + if (array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= config('chocolatey.minRank')) { |
|
201 | + return ['STAFF']; |
|
202 | + } |
|
203 | 203 | |
204 | - return $this->traits; |
|
205 | - } |
|
204 | + return $this->traits; |
|
205 | + } |
|
206 | 206 | |
207 | - /** |
|
207 | + /** |
|
208 | 208 | * We don't care about this? |
209 | 209 | * |
210 | 210 | * @return bool |
211 | 211 | */ |
212 | - public function getTrustedAttribute(): bool |
|
213 | - { |
|
214 | - if (UserSecurity::find($this->attributes['id']) == null) { |
|
215 | - return true; |
|
216 | - } |
|
212 | + public function getTrustedAttribute(): bool |
|
213 | + { |
|
214 | + if (UserSecurity::find($this->attributes['id']) == null) { |
|
215 | + return true; |
|
216 | + } |
|
217 | 217 | |
218 | - return in_array($this->attributes['ip_current'], |
|
219 | - UserSecurity::find($this->attributes['id'])->trustedDevices); |
|
220 | - } |
|
218 | + return in_array($this->attributes['ip_current'], |
|
219 | + UserSecurity::find($this->attributes['id'])->trustedDevices); |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
222 | + /** |
|
223 | 223 | * What is this field? |
224 | 224 | * |
225 | 225 | * @return string |
226 | 226 | */ |
227 | - public function getIdentityTypeAttribute(): string |
|
228 | - { |
|
229 | - return 'HABBO'; |
|
230 | - } |
|
227 | + public function getIdentityTypeAttribute(): string |
|
228 | + { |
|
229 | + return 'HABBO'; |
|
230 | + } |
|
231 | 231 | |
232 | - /** |
|
232 | + /** |
|
233 | 233 | * We don't care about this, every user is trusted. |
234 | 234 | * |
235 | 235 | * @return bool |
236 | 236 | */ |
237 | - public function getIdentityVerifiedAttribute(): bool |
|
238 | - { |
|
239 | - return true; |
|
240 | - } |
|
237 | + public function getIdentityVerifiedAttribute(): bool |
|
238 | + { |
|
239 | + return true; |
|
240 | + } |
|
241 | 241 | |
242 | - /** |
|
242 | + /** |
|
243 | 243 | * We don't care about this. |
244 | 244 | * |
245 | 245 | * @return int |
246 | 246 | */ |
247 | - public function getLoginLogIdAttribute(): int |
|
248 | - { |
|
249 | - return 1; |
|
250 | - } |
|
247 | + public function getLoginLogIdAttribute(): int |
|
248 | + { |
|
249 | + return 1; |
|
250 | + } |
|
251 | 251 | |
252 | - /** |
|
252 | + /** |
|
253 | 253 | * We don't care about this. |
254 | 254 | * |
255 | 255 | * @return int |
256 | 256 | */ |
257 | - public function getSessionLoginIdAttribute(): int |
|
258 | - { |
|
259 | - return 1; |
|
260 | - } |
|
257 | + public function getSessionLoginIdAttribute(): int |
|
258 | + { |
|
259 | + return 1; |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
262 | + /** |
|
263 | 263 | * Get the HabboClub Attribute |
264 | 264 | * In a Retro Habbo everyone is HC, yeah? |
265 | 265 | * |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return bool |
269 | 269 | */ |
270 | - public function getHabboClubMemberAttribute(): bool |
|
271 | - { |
|
272 | - return Config::get('chocolatey.ads.enabled') == false; |
|
273 | - } |
|
270 | + public function getHabboClubMemberAttribute(): bool |
|
271 | + { |
|
272 | + return Config::get('chocolatey.ads.enabled') == false; |
|
273 | + } |
|
274 | 274 | |
275 | - /** |
|
275 | + /** |
|
276 | 276 | * Get the Builders Club Attribute |
277 | 277 | * In a Retro Habbo everyone is BC, yeah? |
278 | 278 | * |
@@ -280,74 +280,74 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return bool |
282 | 282 | */ |
283 | - public function getBuildersClubMemberAttribute(): bool |
|
284 | - { |
|
285 | - return Config::get('chocolatey.ads.enabled') == false; |
|
286 | - } |
|
283 | + public function getBuildersClubMemberAttribute(): bool |
|
284 | + { |
|
285 | + return Config::get('chocolatey.ads.enabled') == false; |
|
286 | + } |
|
287 | 287 | |
288 | - /** |
|
288 | + /** |
|
289 | 289 | * Get GTimestamp in Habbo UserCurrency. |
290 | 290 | * |
291 | 291 | * @return string |
292 | 292 | */ |
293 | - public function getAccountCreatedAttribute(): string |
|
294 | - { |
|
295 | - $accountCreated = $this->attributes['account_created'] ?? time(); |
|
293 | + public function getAccountCreatedAttribute(): string |
|
294 | + { |
|
295 | + $accountCreated = $this->attributes['account_created'] ?? time(); |
|
296 | 296 | |
297 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
298 | - } |
|
297 | + return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
298 | + } |
|
299 | 299 | |
300 | - /** |
|
300 | + /** |
|
301 | 301 | * Get GTimestamp in Habbo UserCurrency. |
302 | 302 | * |
303 | 303 | * @return string |
304 | 304 | */ |
305 | - public function getMemberSinceAttribute(): string |
|
306 | - { |
|
307 | - $accountCreated = $this->attributes['account_created'] ?? time(); |
|
305 | + public function getMemberSinceAttribute(): string |
|
306 | + { |
|
307 | + $accountCreated = $this->attributes['account_created'] ?? time(); |
|
308 | 308 | |
309 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
310 | - } |
|
309 | + return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
310 | + } |
|
311 | 311 | |
312 | - /** |
|
312 | + /** |
|
313 | 313 | * Retrieve User Figure String. |
314 | 314 | * |
315 | 315 | * @return string |
316 | 316 | */ |
317 | - public function getFigureStringAttribute(): string |
|
318 | - { |
|
319 | - return $this->attributes['look'] ?? 'hr-115-42.hd-195-19.ch-3030-82.lg-275-1408.fa-1201.ca-1804-64'; |
|
320 | - } |
|
317 | + public function getFigureStringAttribute(): string |
|
318 | + { |
|
319 | + return $this->attributes['look'] ?? 'hr-115-42.hd-195-19.ch-3030-82.lg-275-1408.fa-1201.ca-1804-64'; |
|
320 | + } |
|
321 | 321 | |
322 | - /** |
|
322 | + /** |
|
323 | 323 | * Get GTimestamp in Habbo UserCurrency. |
324 | 324 | * |
325 | 325 | * @return false|string |
326 | 326 | */ |
327 | - public function getLastLoginAttribute(): string |
|
328 | - { |
|
329 | - $lastLogin = $this->attributes['last_login'] ?? time(); |
|
327 | + public function getLastLoginAttribute(): string |
|
328 | + { |
|
329 | + $lastLogin = $this->attributes['last_login'] ?? time(); |
|
330 | 330 | |
331 | - return date('Y-m-d', $lastLogin).'T'.date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
332 | - } |
|
331 | + return date('Y-m-d', $lastLogin).'T'.date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
332 | + } |
|
333 | 333 | |
334 | - /** |
|
334 | + /** |
|
335 | 335 | * Get E-Mail Verified Attribute. |
336 | 336 | * |
337 | 337 | * @return bool |
338 | 338 | */ |
339 | - public function getEmailVerifiedAttribute(): bool |
|
340 | - { |
|
341 | - return $this->getChocolateyId()->mail_verified ?? false; |
|
342 | - } |
|
339 | + public function getEmailVerifiedAttribute(): bool |
|
340 | + { |
|
341 | + return $this->getChocolateyId()->mail_verified ?? false; |
|
342 | + } |
|
343 | 343 | |
344 | - /** |
|
344 | + /** |
|
345 | 345 | * Get Account Chocolatey Id. |
346 | 346 | * |
347 | 347 | * @return ChocolateyId |
348 | 348 | */ |
349 | - public function getChocolateyId() |
|
350 | - { |
|
351 | - return ChocolateyId::find($this->attributes['mail']); |
|
352 | - } |
|
349 | + public function getChocolateyId() |
|
350 | + { |
|
351 | + return ChocolateyId::find($this->attributes['mail']); |
|
352 | + } |
|
353 | 353 | } |
@@ -1,105 +1,105 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Console\Commands; |
|
3 | + namespace App\Console\Commands; |
|
4 | 4 | |
5 | -use Illuminate\Console\Command; |
|
6 | -use Illuminate\Support\Facades\Storage; |
|
7 | -use PDO; |
|
5 | + use Illuminate\Console\Command; |
|
6 | + use Illuminate\Support\Facades\Storage; |
|
7 | + use PDO; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class Setup. |
11 | 11 | */ |
12 | -class Setup extends Command |
|
13 | -{ |
|
14 | - /** |
|
12 | + class Setup extends Command |
|
13 | + { |
|
14 | + /** |
|
15 | 15 | * The name and signature of the console command. |
16 | 16 | * |
17 | 17 | * @var string |
18 | 18 | */ |
19 | - protected $signature = 'choco:setup'; |
|
19 | + protected $signature = 'choco:setup'; |
|
20 | 20 | |
21 | - /** |
|
21 | + /** |
|
22 | 22 | * The console command description. |
23 | 23 | * |
24 | 24 | * @var string |
25 | 25 | */ |
26 | - protected $description = 'Guide you through the process of configuring your copy of Chocolatey'; |
|
26 | + protected $description = 'Guide you through the process of configuring your copy of Chocolatey'; |
|
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * Create a new command instance. |
30 | 30 | */ |
31 | - public function __construct() |
|
32 | - { |
|
33 | - parent::__construct(); |
|
34 | - } |
|
31 | + public function __construct() |
|
32 | + { |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Execute the console command. |
38 | 38 | * |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function handle() |
|
42 | - { |
|
43 | - $this->comment('Welcome to the Chocolatey Housekeeping setup command'); |
|
44 | - $this->comment('This little command will guide you through the configuration of your copy of Espreso and will prompt you to create the first Super User'); |
|
41 | + public function handle() |
|
42 | + { |
|
43 | + $this->comment('Welcome to the Chocolatey Housekeeping setup command'); |
|
44 | + $this->comment('This little command will guide you through the configuration of your copy of Espreso and will prompt you to create the first Super User'); |
|
45 | 45 | |
46 | - if ($this->confirm('Do you want to continue the setup process?')) { |
|
47 | - $this->comment('First step - SETUP DATABASE'); |
|
46 | + if ($this->confirm('Do you want to continue the setup process?')) { |
|
47 | + $this->comment('First step - SETUP DATABASE'); |
|
48 | 48 | |
49 | - $DB_HOST = $this->ask('Database host? Can take the form of an IP address, FQDN, host alias...'); |
|
50 | - $DB_PORT = $this->ask('MySQL server port? If you don\'t know, type 3306', 3306); |
|
51 | - $DB_USER = $this->ask('Database user?'); |
|
52 | - $DB_PASS = $this->ask('Database password?'); |
|
53 | - $DB_NAME = $this->ask('Database name?'); |
|
49 | + $DB_HOST = $this->ask('Database host? Can take the form of an IP address, FQDN, host alias...'); |
|
50 | + $DB_PORT = $this->ask('MySQL server port? If you don\'t know, type 3306', 3306); |
|
51 | + $DB_USER = $this->ask('Database user?'); |
|
52 | + $DB_PASS = $this->ask('Database password?'); |
|
53 | + $DB_NAME = $this->ask('Database name?'); |
|
54 | 54 | |
55 | - try { |
|
56 | - (new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASS)); |
|
57 | - } catch (\PDOException $e) { |
|
58 | - $this->error('[ERROR] An error occured while configuring the database:'); |
|
59 | - $this->error($e->getMessage()); |
|
60 | - exit(); |
|
61 | - } |
|
55 | + try { |
|
56 | + (new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASS)); |
|
57 | + } catch (\PDOException $e) { |
|
58 | + $this->error('[ERROR] An error occured while configuring the database:'); |
|
59 | + $this->error($e->getMessage()); |
|
60 | + exit(); |
|
61 | + } |
|
62 | 62 | |
63 | - $this->comment('[SUCCESS] Database connection has been established successfully...'); |
|
63 | + $this->comment('[SUCCESS] Database connection has been established successfully...'); |
|
64 | 64 | |
65 | - $this->comment('[INFO] Creating new .env file in Chocolatey storage...'); |
|
65 | + $this->comment('[INFO] Creating new .env file in Chocolatey storage...'); |
|
66 | 66 | |
67 | - Storage::delete('.env'); |
|
68 | - Storage::put('.env', 'APP_ENV=production'); |
|
67 | + Storage::delete('.env'); |
|
68 | + Storage::put('.env', 'APP_ENV=production'); |
|
69 | 69 | |
70 | - $this->comment('[INFO] Generating Chocolatey encryption key for password hashing...'); |
|
71 | - Storage::append('.env', 'APP_KEY='.bin2hex(openssl_random_pseudo_bytes(20))); |
|
70 | + $this->comment('[INFO] Generating Chocolatey encryption key for password hashing...'); |
|
71 | + Storage::append('.env', 'APP_KEY='.bin2hex(openssl_random_pseudo_bytes(20))); |
|
72 | 72 | |
73 | - $this->comment('[INFO] Setting Chocolatey debug mode to false...'); |
|
74 | - Storage::append('.env', 'APP_DEBUG=false'); |
|
73 | + $this->comment('[INFO] Setting Chocolatey debug mode to false...'); |
|
74 | + Storage::append('.env', 'APP_DEBUG=false'); |
|
75 | 75 | |
76 | - $this->comment('[INFO] Setting Espreso logging level to debug...'); |
|
77 | - Storage::append('.env', 'APP_LOG_LEVEL=debug'); |
|
76 | + $this->comment('[INFO] Setting Espreso logging level to debug...'); |
|
77 | + Storage::append('.env', 'APP_LOG_LEVEL=debug'); |
|
78 | 78 | |
79 | - $this->comment('[DATABASE] Setting database driver to mysql...'); |
|
80 | - Storage::append('.env', 'DB_CONNECTION=mysql'); |
|
79 | + $this->comment('[DATABASE] Setting database driver to mysql...'); |
|
80 | + Storage::append('.env', 'DB_CONNECTION=mysql'); |
|
81 | 81 | |
82 | - $this->comment('[INFO] Appending all database credentials to .env file...'); |
|
83 | - Storage::append('.env', 'DB_HOST='.$DB_HOST); |
|
84 | - Storage::append('.env', 'DB_PORT='.$DB_PORT); |
|
85 | - Storage::append('.env', 'DB_DATABASE='.$DB_NAME); |
|
86 | - Storage::append('.env', 'DB_USERNAME='.$DB_USER); |
|
87 | - Storage::append('.env', 'DB_PASSWORD='.$DB_PASS); |
|
88 | - Storage::append('.env', ''); |
|
82 | + $this->comment('[INFO] Appending all database credentials to .env file...'); |
|
83 | + Storage::append('.env', 'DB_HOST='.$DB_HOST); |
|
84 | + Storage::append('.env', 'DB_PORT='.$DB_PORT); |
|
85 | + Storage::append('.env', 'DB_DATABASE='.$DB_NAME); |
|
86 | + Storage::append('.env', 'DB_USERNAME='.$DB_USER); |
|
87 | + Storage::append('.env', 'DB_PASSWORD='.$DB_PASS); |
|
88 | + Storage::append('.env', ''); |
|
89 | 89 | |
90 | - $this->comment('[DRIVERS] Setting broadcast to log...'); |
|
91 | - Storage::append('.env', 'BROADCAST_DRIVER=log'); |
|
90 | + $this->comment('[DRIVERS] Setting broadcast to log...'); |
|
91 | + Storage::append('.env', 'BROADCAST_DRIVER=log'); |
|
92 | 92 | |
93 | - $this->comment('[DRIVERS] Setting cache to file...'); |
|
94 | - Storage::append('.env', 'CACHE_DRIVER=file'); |
|
93 | + $this->comment('[DRIVERS] Setting cache to file...'); |
|
94 | + Storage::append('.env', 'CACHE_DRIVER=file'); |
|
95 | 95 | |
96 | - $this->comment('[DRIVERS] Setting session to file...'); |
|
97 | - Storage::append('.env', 'SESSION_DRIVER=file'); |
|
96 | + $this->comment('[DRIVERS] Setting session to file...'); |
|
97 | + Storage::append('.env', 'SESSION_DRIVER=file'); |
|
98 | 98 | |
99 | - $this->comment('[DRIVERS] Setting queueing to sync...'); |
|
100 | - Storage::append('.env', 'QUEUE_DRIVER=sync'); |
|
101 | - } |
|
99 | + $this->comment('[DRIVERS] Setting queueing to sync...'); |
|
100 | + Storage::append('.env', 'QUEUE_DRIVER=sync'); |
|
101 | + } |
|
102 | 102 | |
103 | - return true; |
|
104 | - } |
|
103 | + return true; |
|
104 | + } |
|
105 | 105 | } |
@@ -1,32 +1,32 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Console; |
|
3 | + namespace App\Console; |
|
4 | 4 | |
5 | -use Illuminate\Console\Scheduling\Schedule; |
|
6 | -use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
5 | + use Illuminate\Console\Scheduling\Schedule; |
|
6 | + use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class Kernel. |
10 | 10 | */ |
11 | -class Kernel extends ConsoleKernel |
|
12 | -{ |
|
13 | - /** |
|
11 | + class Kernel extends ConsoleKernel |
|
12 | + { |
|
13 | + /** |
|
14 | 14 | * The Artisan commands provided by your application. |
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected $commands = [ |
|
19 | - Commands\Setup::class, |
|
20 | - ]; |
|
18 | + protected $commands = [ |
|
19 | + Commands\Setup::class, |
|
20 | + ]; |
|
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Define the application's command schedule. |
24 | 24 | * |
25 | 25 | * @param \Illuminate\Console\Scheduling\Schedule $schedule |
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - protected function schedule(Schedule $schedule) |
|
30 | - { |
|
31 | - } |
|
29 | + protected function schedule(Schedule $schedule) |
|
30 | + { |
|
31 | + } |
|
32 | 32 | } |