@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
| 57 | 57 | { |
| 58 | - $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 58 | + $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function($item) use ($category) { |
|
| 59 | 59 | return $category->name == 'all' || in_array($category, $item->categories); |
| 60 | 60 | }); |
| 61 | 61 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return response()->json(null, 404); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 83 | + $related = ($latest = Article::all())->filter(function($item) use ($article) { |
|
| 84 | 84 | return in_array($article->categories[0], $item->categories); |
| 85 | 85 | }); |
| 86 | 86 | |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Models\Article; |
|
| 6 | -use App\Models\ArticleCategory; |
|
| 7 | -use Illuminate\Http\Response; |
|
| 8 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Models\Article; |
|
| 6 | + use App\Models\ArticleCategory; |
|
| 7 | + use Illuminate\Http\Response; |
|
| 8 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class ArticleController. |
| 12 | 12 | */ |
| 13 | -class ArticleController extends BaseController |
|
| 14 | -{ |
|
| 15 | - /** |
|
| 13 | + class ArticleController extends BaseController |
|
| 14 | + { |
|
| 15 | + /** |
|
| 16 | 16 | * Render a specific view of Article set. |
| 17 | 17 | * |
| 18 | 18 | * @param string $countryId |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return Response |
| 22 | 22 | */ |
| 23 | - public function many(string $countryId, string $articleCategory): Response |
|
| 24 | - { |
|
| 25 | - $category = ArticleCategory::find(strstr(($articleCategory = |
|
| 26 | - str_replace('.html', '', $articleCategory)), '_', true)); |
|
| 23 | + public function many(string $countryId, string $articleCategory): Response |
|
| 24 | + { |
|
| 25 | + $category = ArticleCategory::find(strstr(($articleCategory = |
|
| 26 | + str_replace('.html', '', $articleCategory)), '_', true)); |
|
| 27 | 27 | |
| 28 | - $categoryPage = strstr(strrev($articleCategory), '_', true); |
|
| 28 | + $categoryPage = strstr(strrev($articleCategory), '_', true); |
|
| 29 | 29 | |
| 30 | - return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage, |
|
| 31 | - $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1))); |
|
| 32 | - } |
|
| 30 | + return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage, |
|
| 31 | + $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1))); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | + /** |
|
| 35 | 35 | * Render the Front Page of the Articles Page. |
| 36 | 36 | * |
| 37 | 37 | * @return Response |
| 38 | 38 | */ |
| 39 | - protected function front(): Response |
|
| 40 | - { |
|
| 41 | - return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()])); |
|
| 42 | - } |
|
| 39 | + protected function front(): Response |
|
| 40 | + { |
|
| 41 | + return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()])); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * Render a specific Category Articles Page. |
| 46 | 46 | * |
| 47 | 47 | * @TODO: Proper Way to use Country ID |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return Response |
| 55 | 55 | */ |
| 56 | - protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
|
| 57 | - { |
|
| 58 | - $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 59 | - return $category->name == 'all' || in_array($category, $item->categories); |
|
| 60 | - }); |
|
| 56 | + protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
|
| 57 | + { |
|
| 58 | + $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 59 | + return $category->name == 'all' || in_array($category, $item->categories); |
|
| 60 | + }); |
|
| 61 | 61 | |
| 62 | - return response(view('habbo-web-news.articles-category', [ |
|
| 63 | - 'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles, |
|
| 64 | - ])); |
|
| 65 | - } |
|
| 62 | + return response(view('habbo-web-news.articles-category', [ |
|
| 63 | + 'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles, |
|
| 64 | + ])); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 67 | + /** |
|
| 68 | 68 | * Render a specific view of a specific Article. |
| 69 | 69 | * |
| 70 | 70 | * @TODO: Proper Way to use Country ID |
@@ -74,28 +74,28 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return Response |
| 76 | 76 | */ |
| 77 | - public function one(string $countryId, string $articleName): Response |
|
| 78 | - { |
|
| 79 | - if (($article = Article::find(strstr($articleName, '_', true))) == null) { |
|
| 80 | - return response()->json(null, 404); |
|
| 81 | - } |
|
| 77 | + public function one(string $countryId, string $articleName): Response |
|
| 78 | + { |
|
| 79 | + if (($article = Article::find(strstr($articleName, '_', true))) == null) { |
|
| 80 | + return response()->json(null, 404); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 84 | - return in_array($article->categories[0], $item->categories); |
|
| 85 | - }); |
|
| 83 | + $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 84 | + return in_array($article->categories[0], $item->categories); |
|
| 85 | + }); |
|
| 86 | 86 | |
| 87 | - return response(view('habbo-web-news.articles-view', |
|
| 88 | - ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)] |
|
| 89 | - )); |
|
| 90 | - } |
|
| 87 | + return response(view('habbo-web-news.articles-view', |
|
| 88 | + ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)] |
|
| 89 | + )); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 92 | + /** |
|
| 93 | 93 | * Get All Habbo Articles as XML/RSS. |
| 94 | 94 | * |
| 95 | 95 | * @return Response |
| 96 | 96 | */ |
| 97 | - public function getRss() |
|
| 98 | - { |
|
| 99 | - return response(view('habbo-web-pages.habbo-rss', ['articles' => Article::limit(20)->get()]))->header('Content-Type', 'text/xml'); |
|
| 100 | - } |
|
| 97 | + public function getRss() |
|
| 98 | + { |
|
| 99 | + return response(view('habbo-web-pages.habbo-rss', ['articles' => Article::limit(20)->get()]))->header('Content-Type', 'text/xml'); |
|
| 100 | + } |
|
| 101 | 101 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getUserHead(Request $request) |
| 27 | 27 | { |
| 28 | - return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | - User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 28 | + return redirect(Config::get('chocolatey.imaging') . 'avatarimage?figure=' . ($request->has('figure') ? $request->input('figure') : User::where('username', $request->input('user'))->first()->figureString) . '&size=l&headonly=1'); |
|
| 30 | 29 | } |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -39,7 +38,7 @@ discard block |
||
| 39 | 38 | */ |
| 40 | 39 | public function getUserBody(string $figure) |
| 41 | 40 | { |
| 42 | - return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 41 | + return redirect(Config::get('chocolatey.imaging') . "avatar/{$figure}"); |
|
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | /** |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Models\EmulatorSettings; |
|
| 6 | -use App\Models\User; |
|
| 7 | -use Illuminate\Http\Request; |
|
| 8 | -use Illuminate\Support\Facades\Config; |
|
| 9 | -use Intervention\Image\Facades\Image; |
|
| 10 | -use Laravel\Lumen\Http\Redirector; |
|
| 11 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Models\EmulatorSettings; |
|
| 6 | + use App\Models\User; |
|
| 7 | + use Illuminate\Http\Request; |
|
| 8 | + use Illuminate\Support\Facades\Config; |
|
| 9 | + use Intervention\Image\Facades\Image; |
|
| 10 | + use Laravel\Lumen\Http\Redirector; |
|
| 11 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class ImagingController. |
| 15 | 15 | */ |
| 16 | -class ImagingController extends BaseController |
|
| 17 | -{ |
|
| 18 | - /** |
|
| 16 | + class ImagingController extends BaseController |
|
| 17 | + { |
|
| 18 | + /** |
|
| 19 | 19 | * Get User Figure for Big Header |
| 20 | 20 | * based on User Name or Figure. |
| 21 | 21 | * |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return Redirector |
| 25 | 25 | */ |
| 26 | - public function getUserHead(Request $request) |
|
| 27 | - { |
|
| 28 | - return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | - User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 30 | - } |
|
| 26 | + public function getUserHead(Request $request) |
|
| 27 | + { |
|
| 28 | + return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | + User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Get User Figure for Body |
| 34 | 34 | * based on User Figure. |
| 35 | 35 | * |
@@ -37,36 +37,36 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return Redirector |
| 39 | 39 | */ |
| 40 | - public function getUserBody(string $figure) |
|
| 41 | - { |
|
| 42 | - return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 43 | - } |
|
| 40 | + public function getUserBody(string $figure) |
|
| 41 | + { |
|
| 42 | + return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * Get Youtube Thumbnail. |
| 47 | 47 | * |
| 48 | 48 | * @param Request $request |
| 49 | 49 | * |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function getYoutubeThumbnail(Request $request) |
|
| 53 | - { |
|
| 54 | - return Image::make($request->input('url'))->response('jpg'); |
|
| 55 | - } |
|
| 52 | + public function getYoutubeThumbnail(Request $request) |
|
| 53 | + { |
|
| 54 | + return Image::make($request->input('url'))->response('jpg'); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Return Group Badge. |
| 59 | 59 | * |
| 60 | 60 | * @param string $badgeCode |
| 61 | 61 | * |
| 62 | 62 | * @return mixed |
| 63 | 63 | */ |
| 64 | - public function getGroupBadge(string $badgeCode) |
|
| 65 | - { |
|
| 66 | - $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first(); |
|
| 64 | + public function getGroupBadge(string $badgeCode) |
|
| 65 | + { |
|
| 66 | + $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first(); |
|
| 67 | 67 | |
| 68 | - $badgeCode = str_replace('.gif', '', $badgeCode); |
|
| 68 | + $badgeCode = str_replace('.gif', '', $badgeCode); |
|
| 69 | 69 | |
| 70 | - return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif'); |
|
| 71 | - } |
|
| 70 | + return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif'); |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | */ |
| 123 | 123 | public function hasSession() |
| 124 | 124 | { |
| 125 | - return (bool) Session::get(Config::get('chocolatey.security.session')); |
|
| 125 | + return (bool)Session::get(Config::get('chocolatey.security.session')); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -1,9 +1,9 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Console; |
|
| 3 | + namespace App\Console; |
|
| 4 | 4 | |
| 5 | -use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
| 5 | + use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
| 6 | 6 | |
| 7 | -class Kernel extends ConsoleKernel |
|
| 8 | -{ |
|
| 7 | + class Kernel extends ConsoleKernel |
|
| 8 | + { |
|
| 9 | 9 | } |
@@ -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 FlatCat. |
| 7 | 7 | */ |
| 8 | -class FlatCat extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class FlatCat 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 = 'navigator_flatcats'; |
|
| 22 | + protected $table = 'navigator_flatcats'; |
|
| 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,85 +1,85 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class ShopInventory. |
| 7 | 7 | */ |
| 8 | -class ShopInventory |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class ShopInventory |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Payment Categories of the Country. |
| 12 | 12 | * |
| 13 | 13 | * @var PaymentCategory[] |
| 14 | 14 | */ |
| 15 | - public $paymentCategories = []; |
|
| 15 | + public $paymentCategories = []; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Inventory Items. |
| 19 | 19 | * |
| 20 | 20 | * @var array |
| 21 | 21 | */ |
| 22 | - public $pricePoints = []; |
|
| 22 | + public $pricePoints = []; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * If double Credits are Enabled. |
| 26 | 26 | * |
| 27 | 27 | * @var bool |
| 28 | 28 | */ |
| 29 | - public $doubleCredits = false; |
|
| 29 | + public $doubleCredits = false; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Country Meta Data. |
| 33 | 33 | * |
| 34 | 34 | * @var Country |
| 35 | 35 | */ |
| 36 | - public $country = null; |
|
| 36 | + public $country = null; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * Create a Shop Inventory. |
| 40 | 40 | * |
| 41 | 41 | * @param Country $country |
| 42 | 42 | */ |
| 43 | - public function __construct(Country $country) |
|
| 44 | - { |
|
| 45 | - $this->setCountry($country); |
|
| 46 | - $this->setPaymentCategories($country->countryCode); |
|
| 47 | - $this->setPricePoints($country->countryCode); |
|
| 48 | - } |
|
| 43 | + public function __construct(Country $country) |
|
| 44 | + { |
|
| 45 | + $this->setCountry($country); |
|
| 46 | + $this->setPaymentCategories($country->countryCode); |
|
| 47 | + $this->setPricePoints($country->countryCode); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * Set the Country Metadata. |
| 52 | 52 | * |
| 53 | 53 | * @param Country $country |
| 54 | 54 | */ |
| 55 | - public function setCountry(Country $country) |
|
| 56 | - { |
|
| 57 | - $this->country = $country; |
|
| 58 | - } |
|
| 55 | + public function setCountry(Country $country) |
|
| 56 | + { |
|
| 57 | + $this->country = $country; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | + /** |
|
| 61 | 61 | * Set the Payment Methods. |
| 62 | 62 | * |
| 63 | 63 | * @param string $countryCode |
| 64 | 64 | */ |
| 65 | - public function setPaymentCategories(string $countryCode) |
|
| 66 | - { |
|
| 67 | - $paymentMethods = []; |
|
| 65 | + public function setPaymentCategories(string $countryCode) |
|
| 66 | + { |
|
| 67 | + $paymentMethods = []; |
|
| 68 | 68 | |
| 69 | - foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) { |
|
| 70 | - $paymentMethods[] = $paymentMethod->payment_type; |
|
| 71 | - } |
|
| 69 | + foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) { |
|
| 70 | + $paymentMethods[] = $paymentMethod->payment_type; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $this->paymentCategories = $paymentMethods; |
|
| 74 | - } |
|
| 73 | + $this->paymentCategories = $paymentMethods; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 76 | + /** |
|
| 77 | 77 | * Get All Shop Items from this Country Code. |
| 78 | 78 | * |
| 79 | 79 | * @param string $countryCode |
| 80 | 80 | */ |
| 81 | - public function setPricePoints(string $countryCode) |
|
| 82 | - { |
|
| 83 | - $this->pricePoints = ShopItem::where('countryCode', $countryCode)->get(); |
|
| 84 | - } |
|
| 81 | + public function setPricePoints(string $countryCode) |
|
| 82 | + { |
|
| 83 | + $this->pricePoints = ShopItem::where('countryCode', $countryCode)->get(); |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Model; |
|
| 5 | + use Illuminate\Database\Eloquent\Model; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Class ChocolateyModel. |
| 9 | 9 | */ |
| 10 | -abstract class ChocolateyModel extends Model |
|
| 11 | -{ |
|
| 10 | + abstract class ChocolateyModel extends Model |
|
| 11 | + { |
|
| 12 | 12 | } |
@@ -1,109 +1,109 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class UserProfile. |
| 7 | 7 | */ |
| 8 | -class UserProfile |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class UserProfile |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * User Data. |
| 12 | 12 | * |
| 13 | 13 | * @var User |
| 14 | 14 | */ |
| 15 | - public $user; |
|
| 15 | + public $user; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * User Friends. |
| 19 | 19 | * |
| 20 | 20 | * @var UserFriend[]|array |
| 21 | 21 | */ |
| 22 | - public $friends = []; |
|
| 22 | + public $friends = []; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * User Badges. |
| 26 | 26 | * |
| 27 | 27 | * @var UserBadge[]|array |
| 28 | 28 | */ |
| 29 | - public $badges = []; |
|
| 29 | + public $badges = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * User Groups. |
| 33 | 33 | * |
| 34 | 34 | * @var UserGroup[]|array |
| 35 | 35 | */ |
| 36 | - public $groups = []; |
|
| 36 | + public $groups = []; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * User Rooms. |
| 40 | 40 | * |
| 41 | 41 | * @var Room[]|array |
| 42 | 42 | */ |
| 43 | - public $rooms = []; |
|
| 43 | + public $rooms = []; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * UserProfile constructor. |
| 47 | 47 | * |
| 48 | 48 | * @param User $userData |
| 49 | 49 | * |
| 50 | 50 | * @return UserProfile |
| 51 | 51 | */ |
| 52 | - public function __construct(User $userData) |
|
| 53 | - { |
|
| 54 | - $this->setUser($userData); |
|
| 52 | + public function __construct(User $userData) |
|
| 53 | + { |
|
| 54 | + $this->setUser($userData); |
|
| 55 | 55 | |
| 56 | - $this->setFriends(); |
|
| 57 | - $this->setBadges(); |
|
| 58 | - $this->setGroups(); |
|
| 59 | - $this->setRooms(); |
|
| 56 | + $this->setFriends(); |
|
| 57 | + $this->setBadges(); |
|
| 58 | + $this->setGroups(); |
|
| 59 | + $this->setRooms(); |
|
| 60 | 60 | |
| 61 | - return $this; |
|
| 62 | - } |
|
| 61 | + return $this; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 64 | + /** |
|
| 65 | 65 | * Set User Data. |
| 66 | 66 | * |
| 67 | 67 | * @param User $userData |
| 68 | 68 | */ |
| 69 | - protected function setUser(User $userData) |
|
| 70 | - { |
|
| 71 | - $this->user = $userData; |
|
| 72 | - } |
|
| 69 | + protected function setUser(User $userData) |
|
| 70 | + { |
|
| 71 | + $this->user = $userData; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | + /** |
|
| 75 | 75 | * Set User Friends. |
| 76 | 76 | */ |
| 77 | - protected function setFriends() |
|
| 78 | - { |
|
| 79 | - $this->friends = UserFriend::where('user_one_id', $this->user->uniqueId)->get() ?? []; |
|
| 80 | - } |
|
| 77 | + protected function setFriends() |
|
| 78 | + { |
|
| 79 | + $this->friends = UserFriend::where('user_one_id', $this->user->uniqueId)->get() ?? []; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | + /** |
|
| 83 | 83 | * Set User Badges. |
| 84 | 84 | */ |
| 85 | - protected function setBadges() |
|
| 86 | - { |
|
| 87 | - $this->badges = UserBadge::where('user_id', $this->user->uniqueId)->get() ?? []; |
|
| 88 | - } |
|
| 85 | + protected function setBadges() |
|
| 86 | + { |
|
| 87 | + $this->badges = UserBadge::where('user_id', $this->user->uniqueId)->get() ?? []; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 90 | + /** |
|
| 91 | 91 | * Set User Groups. |
| 92 | 92 | */ |
| 93 | - protected function setGroups() |
|
| 94 | - { |
|
| 95 | - $groups = GroupMember::where('user_id', $this->user->uniqueId)->get() ?? []; |
|
| 93 | + protected function setGroups() |
|
| 94 | + { |
|
| 95 | + $groups = GroupMember::where('user_id', $this->user->uniqueId)->get() ?? []; |
|
| 96 | 96 | |
| 97 | - foreach ($groups as $group) { |
|
| 98 | - $this->groups[] = $group->guild; |
|
| 99 | - } |
|
| 100 | - } |
|
| 97 | + foreach ($groups as $group) { |
|
| 98 | + $this->groups[] = $group->guild; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 102 | + /** |
|
| 103 | 103 | * Set User Rooms. |
| 104 | 104 | */ |
| 105 | - public function setRooms() |
|
| 106 | - { |
|
| 107 | - $this->rooms = Room::where('owner_id', $this->user->uniqueId)->where('state', '!=', 'invisible')->get() ?? []; |
|
| 108 | - } |
|
| 105 | + public function setRooms() |
|
| 106 | + { |
|
| 107 | + $this->rooms = Room::where('owner_id', $this->user->uniqueId)->where('state', '!=', 'invisible')->get() ?? []; |
|
| 108 | + } |
|
| 109 | 109 | } |
@@ -1,61 +1,61 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class Purse. |
| 7 | 7 | */ |
| 8 | -class Purse |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Purse |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * User Credits Balance. |
| 12 | 12 | * |
| 13 | 13 | * @var int |
| 14 | 14 | */ |
| 15 | - public $creditBalance = 0; |
|
| 15 | + public $creditBalance = 0; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * User Builders Club Furniture Limit. |
| 19 | 19 | * |
| 20 | 20 | * @var int |
| 21 | 21 | */ |
| 22 | - public $buildersClubFurniLimit = 0; |
|
| 22 | + public $buildersClubFurniLimit = 0; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Remaining Builders Club Days. |
| 26 | 26 | * |
| 27 | 27 | * @var int |
| 28 | 28 | */ |
| 29 | - public $buildersClubDays = 0; |
|
| 29 | + public $buildersClubDays = 0; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * User Habbo Club Days. |
| 33 | 33 | * |
| 34 | 34 | * @var int |
| 35 | 35 | */ |
| 36 | - public $habboClubDays = 0; |
|
| 36 | + public $habboClubDays = 0; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * User Diamond Balance. |
| 40 | 40 | * |
| 41 | 41 | * @var int |
| 42 | 42 | */ |
| 43 | - public $diamondBalance = 0; |
|
| 43 | + public $diamondBalance = 0; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * Create an User Purse. |
| 47 | 47 | * |
| 48 | 48 | * @TODO: Get User Left Habbo Club Days |
| 49 | 49 | * |
| 50 | 50 | * @param int $userId |
| 51 | 51 | */ |
| 52 | - public function __construct(int $userId) |
|
| 53 | - { |
|
| 54 | - $userDiamonds = UserCurrency::where('user_id', $userId)->where('type', 5)->first(); |
|
| 55 | - $habboDays = floor(((UserSettings::where('user_id', $userId)->first()->club_expire_timestamp ?? 0) - time()) / 86400); |
|
| 56 | - |
|
| 57 | - $this->creditBalance = User::find($userId)->credits; |
|
| 58 | - $this->diamondBalance = $userDiamonds->amount ?? 0; |
|
| 59 | - $this->habboClubDays = $habboDays > 0 ? $habboDays : 0; |
|
| 60 | - } |
|
| 52 | + public function __construct(int $userId) |
|
| 53 | + { |
|
| 54 | + $userDiamonds = UserCurrency::where('user_id', $userId)->where('type', 5)->first(); |
|
| 55 | + $habboDays = floor(((UserSettings::where('user_id', $userId)->first()->club_expire_timestamp ?? 0) - time()) / 86400); |
|
| 56 | + |
|
| 57 | + $this->creditBalance = User::find($userId)->credits; |
|
| 58 | + $this->diamondBalance = $userDiamonds->amount ?? 0; |
|
| 59 | + $this->habboClubDays = $habboDays > 0 ? $habboDays : 0; |
|
| 60 | + } |
|
| 61 | 61 | } |