@@ -1,73 +1,73 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\Nux; |
|
6 | -use App\Facades\User as UserFacade; |
|
7 | -use App\Facades\Validation; |
|
8 | -use App\Models\NuxValidation; |
|
9 | -use App\Models\User; |
|
10 | -use Illuminate\Http\JsonResponse; |
|
11 | -use Illuminate\Http\Request; |
|
12 | -use Illuminate\Http\Response; |
|
13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\Nux; |
|
6 | + use App\Facades\User as UserFacade; |
|
7 | + use App\Facades\Validation; |
|
8 | + use App\Models\NuxValidation; |
|
9 | + use App\Models\User; |
|
10 | + use Illuminate\Http\JsonResponse; |
|
11 | + use Illuminate\Http\Request; |
|
12 | + use Illuminate\Http\Response; |
|
13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class NuxController. |
17 | 17 | */ |
18 | -class NuxController extends BaseController |
|
19 | -{ |
|
20 | - /** |
|
18 | + class NuxController extends BaseController |
|
19 | + { |
|
20 | + /** |
|
21 | 21 | * Check an User Name. |
22 | 22 | * |
23 | 23 | * @param Request $request |
24 | 24 | * |
25 | 25 | * @return JsonResponse |
26 | 26 | */ |
27 | - public function checkName(Request $request): JsonResponse |
|
28 | - { |
|
29 | - if (User::where('username', $request->json()->get('name'))->where('id', '<>', UserFacade::getUser()->uniqueId)->count() > 0) { |
|
30 | - return response()->json(new NuxValidation('NAME_IN_USE')); |
|
31 | - } |
|
27 | + public function checkName(Request $request): JsonResponse |
|
28 | + { |
|
29 | + if (User::where('username', $request->json()->get('name'))->where('id', '<>', UserFacade::getUser()->uniqueId)->count() > 0) { |
|
30 | + return response()->json(new NuxValidation('NAME_IN_USE')); |
|
31 | + } |
|
32 | 32 | |
33 | - if (!Validation::filterUserName($request->json()->get('name'))) { |
|
34 | - return response()->json(new NuxValidation('INVALID_NAME', ['resultType' => 'VALIDATION_ERROR_ILLEGAL_WORDS'])); |
|
35 | - } |
|
33 | + if (!Validation::filterUserName($request->json()->get('name'))) { |
|
34 | + return response()->json(new NuxValidation('INVALID_NAME', ['resultType' => 'VALIDATION_ERROR_ILLEGAL_WORDS'])); |
|
35 | + } |
|
36 | 36 | |
37 | - return response()->json(new NuxValidation()); |
|
38 | - } |
|
37 | + return response()->json(new NuxValidation()); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
40 | + /** |
|
41 | 41 | * Select an User Name. |
42 | 42 | * |
43 | 43 | * @param Request $request |
44 | 44 | * |
45 | 45 | * @return JsonResponse |
46 | 46 | */ |
47 | - public function selectName(Request $request): JsonResponse |
|
48 | - { |
|
49 | - UserFacade::updateSession(['username' => $request->json()->get('name')]); |
|
47 | + public function selectName(Request $request): JsonResponse |
|
48 | + { |
|
49 | + UserFacade::updateSession(['username' => $request->json()->get('name')]); |
|
50 | 50 | |
51 | - return response()->json(new NuxValidation()); |
|
52 | - } |
|
51 | + return response()->json(new NuxValidation()); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
54 | + /** |
|
55 | 55 | * Select a Room. |
56 | 56 | * |
57 | 57 | * @param Request $request |
58 | 58 | * |
59 | 59 | * @return Response |
60 | 60 | */ |
61 | - public function selectRoom(Request $request): Response |
|
62 | - { |
|
63 | - if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) { |
|
64 | - return response('', 400); |
|
65 | - } |
|
61 | + public function selectRoom(Request $request): Response |
|
62 | + { |
|
63 | + if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) { |
|
64 | + return response('', 400); |
|
65 | + } |
|
66 | 66 | |
67 | - Nux::generateRoom($request); |
|
67 | + Nux::generateRoom($request); |
|
68 | 68 | |
69 | - UserFacade::getUser()->traits = ['USER']; |
|
69 | + UserFacade::getUser()->traits = ['USER']; |
|
70 | 70 | |
71 | - return response(null, 200); |
|
72 | - } |
|
71 | + return response(null, 200); |
|
72 | + } |
|
73 | 73 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use Illuminate\Http\Response; |
|
6 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use Illuminate\Http\Response; |
|
6 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class PageController. |
10 | 10 | */ |
11 | -class PageController extends BaseController |
|
12 | -{ |
|
13 | - /** |
|
11 | + class PageController extends BaseController |
|
12 | + { |
|
13 | + /** |
|
14 | 14 | * Render a HabboWEB Page. |
15 | 15 | * |
16 | 16 | * @param string $pageCategory |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return Response |
20 | 20 | */ |
21 | - public function show(string $pageCategory, string $pageFile): Response |
|
22 | - { |
|
23 | - $pageArray = explode('.', $pageFile); |
|
21 | + public function show(string $pageCategory, string $pageFile): Response |
|
22 | + { |
|
23 | + $pageArray = explode('.', $pageFile); |
|
24 | 24 | |
25 | - return response(view("habbo-web-pages.{$pageCategory}.{$pageArray[0]}")); |
|
26 | - } |
|
25 | + return response(view("habbo-web-pages.{$pageCategory}.{$pageArray[0]}")); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * Render a HabboPage. |
30 | 30 | * |
31 | 31 | * @WARNING: Categories can still be pages |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return Response |
37 | 37 | */ |
38 | - public function habboPage(string $category, string $page = '') |
|
39 | - { |
|
40 | - return response(view(empty($page) ? "habbo-pages.{$category}" : "habbo-pages.{$category}.{$page}")); |
|
41 | - } |
|
38 | + public function habboPage(string $category, string $page = '') |
|
39 | + { |
|
40 | + return response(view(empty($page) ? "habbo-pages.{$category}" : "habbo-pages.{$category}.{$page}")); |
|
41 | + } |
|
42 | 42 | } |
@@ -1,23 +1,23 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use Illuminate\Http\Response; |
|
6 | -use Illuminate\Support\Facades\Redirect; |
|
7 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use Illuminate\Http\Response; |
|
6 | + use Illuminate\Support\Facades\Redirect; |
|
7 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class HomePageController. |
11 | 11 | */ |
12 | -class HomePageController extends BaseController |
|
13 | -{ |
|
14 | - /** |
|
12 | + class HomePageController extends BaseController |
|
13 | + { |
|
14 | + /** |
|
15 | 15 | * Render the Home Page. |
16 | 16 | * |
17 | 17 | * @return Response|Redirect |
18 | 18 | */ |
19 | - public function show() |
|
20 | - { |
|
21 | - return response(view('habbo-web-pages.habbo-web')); |
|
22 | - } |
|
19 | + public function show() |
|
20 | + { |
|
21 | + return response(view('habbo-web-pages.habbo-web')); |
|
22 | + } |
|
23 | 23 | } |
@@ -1,53 +1,53 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\User; |
|
6 | -use Illuminate\Http\Request; |
|
7 | -use Illuminate\Http\Response; |
|
8 | -use Illuminate\Support\Facades\Config; |
|
9 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User; |
|
6 | + use Illuminate\Http\Request; |
|
7 | + use Illuminate\Http\Response; |
|
8 | + use Illuminate\Support\Facades\Config; |
|
9 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Class ClientController. |
13 | 13 | */ |
14 | -class ClientController extends BaseController |
|
15 | -{ |
|
16 | - /** |
|
14 | + class ClientController extends BaseController |
|
15 | + { |
|
16 | + /** |
|
17 | 17 | * Returns the Client URL. |
18 | 18 | * |
19 | 19 | * @param Request $request |
20 | 20 | * |
21 | 21 | * @return Response |
22 | 22 | */ |
23 | - public function getUrl(Request $request) |
|
24 | - { |
|
25 | - $hotelUrl = Config::get('chocolatey.hotelUrl'); |
|
23 | + public function getUrl(Request $request) |
|
24 | + { |
|
25 | + $hotelUrl = Config::get('chocolatey.hotelUrl'); |
|
26 | 26 | |
27 | - return response()->json(['clienturl' => "{$hotelUrl}/client/habbo-client"], 200, [], JSON_UNESCAPED_SLASHES); |
|
28 | - } |
|
27 | + return response()->json(['clienturl' => "{$hotelUrl}/client/habbo-client"], 200, [], JSON_UNESCAPED_SLASHES); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
30 | + /** |
|
31 | 31 | * Get Client View. |
32 | 32 | * |
33 | 33 | * @return Response |
34 | 34 | */ |
35 | - public function showClient(): Response |
|
36 | - { |
|
37 | - User::updateSession(['auth_ticket' => ($userToken = uniqid('HabboWEB', true))]); |
|
35 | + public function showClient(): Response |
|
36 | + { |
|
37 | + User::updateSession(['auth_ticket' => ($userToken = uniqid('HabboWEB', true))]); |
|
38 | 38 | |
39 | - return response(view('habbo-web-pages.habbo-client', ['token' => $userToken, 'newUser' => in_array('NEW_USER', User::getUser()->traits)])); |
|
40 | - } |
|
39 | + return response(view('habbo-web-pages.habbo-client', ['token' => $userToken, 'newUser' => in_array('NEW_USER', User::getUser()->traits)])); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
42 | + /** |
|
43 | 43 | * Get HabboWEB Ads Interstitial. |
44 | 44 | * |
45 | 45 | * @param string $interstitialType |
46 | 46 | * |
47 | 47 | * @return Response |
48 | 48 | */ |
49 | - public function getInterstitial(string $interstitialType): Response |
|
50 | - { |
|
51 | - return response(view('habbo-web-ads.interstitial')); |
|
52 | - } |
|
49 | + public function getInterstitial(string $interstitialType): Response |
|
50 | + { |
|
51 | + return response(view('habbo-web-ads.interstitial')); |
|
52 | + } |
|
53 | 53 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | /** |
66 | 66 | * Check if a Key exists in the Session. |
67 | 67 | * |
68 | - * @param mixed $key |
|
68 | + * @param string $key |
|
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
@@ -1,17 +1,17 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Models\Room; |
|
6 | -use Illuminate\Http\JsonResponse; |
|
7 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Models\Room; |
|
6 | + use Illuminate\Http\JsonResponse; |
|
7 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class RoomsController. |
11 | 11 | */ |
12 | -class RoomsController extends BaseController |
|
13 | -{ |
|
14 | - /** |
|
12 | + class RoomsController extends BaseController |
|
13 | + { |
|
14 | + /** |
|
15 | 15 | * Get LeaderBoard Data. |
16 | 16 | * |
17 | 17 | * @TODO: Make Possible Filter with all the Possible Criteria |
@@ -22,26 +22,26 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return JsonResponse |
24 | 24 | */ |
25 | - public function getLeader($countryId, $roomRange, $roomInterval): JsonResponse |
|
26 | - { |
|
27 | - $leaderRank = 1; |
|
25 | + public function getLeader($countryId, $roomRange, $roomInterval): JsonResponse |
|
26 | + { |
|
27 | + $leaderRank = 1; |
|
28 | 28 | |
29 | - foreach (($leaderBoard = Room::where('state', '!=', 'invisible')->orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) { |
|
30 | - $room->leaderboardRank = $leaderRank++; |
|
31 | - } |
|
29 | + foreach (($leaderBoard = Room::where('state', '!=', 'invisible')->orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) { |
|
30 | + $room->leaderboardRank = $leaderRank++; |
|
31 | + } |
|
32 | 32 | |
33 | - return response()->json($leaderBoard, 200, [], JSON_UNESCAPED_SLASHES); |
|
34 | - } |
|
33 | + return response()->json($leaderBoard, 200, [], JSON_UNESCAPED_SLASHES); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Get a specific Room Data. |
38 | 38 | * |
39 | 39 | * @param int $roomId |
40 | 40 | * |
41 | 41 | * @return JsonResponse |
42 | 42 | */ |
43 | - public function getRoom($roomId): JsonResponse |
|
44 | - { |
|
45 | - return response()->json(Room::find($roomId) ?? ['error' => 'not-found'], 200, [], JSON_UNESCAPED_SLASHES); |
|
46 | - } |
|
43 | + public function getRoom($roomId): JsonResponse |
|
44 | + { |
|
45 | + return response()->json(Room::find($roomId) ?? ['error' => 'not-found'], 200, [], JSON_UNESCAPED_SLASHES); |
|
46 | + } |
|
47 | 47 | } |
@@ -1,68 +1,68 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\User as UserFacade; |
|
6 | -use App\Models\ChocolateyId; |
|
7 | -use App\Models\User; |
|
8 | -use Facebook\Facebook; |
|
9 | -use Facebook\GraphNodes\GraphUser; |
|
10 | -use Illuminate\Http\JsonResponse; |
|
11 | -use Illuminate\Http\Request; |
|
12 | -use Illuminate\Support\Facades\Config; |
|
13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User as UserFacade; |
|
6 | + use App\Models\ChocolateyId; |
|
7 | + use App\Models\User; |
|
8 | + use Facebook\Facebook; |
|
9 | + use Facebook\GraphNodes\GraphUser; |
|
10 | + use Illuminate\Http\JsonResponse; |
|
11 | + use Illuminate\Http\Request; |
|
12 | + use Illuminate\Support\Facades\Config; |
|
13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class LoginController. |
17 | 17 | */ |
18 | -class LoginController extends BaseController |
|
19 | -{ |
|
20 | - /** |
|
18 | + class LoginController extends BaseController |
|
19 | + { |
|
20 | + /** |
|
21 | 21 | * Handles the Response of the Login Attempt. |
22 | 22 | * |
23 | 23 | * @param Request $request |
24 | 24 | * |
25 | 25 | * @return JsonResponse |
26 | 26 | */ |
27 | - public function login(Request $request): JsonResponse |
|
28 | - { |
|
29 | - if (UserFacade::loginUser($request) !== null) { |
|
30 | - if (UserFacade::getUser()->isBanned) { |
|
31 | - return $this->sendBanMessage($request); |
|
32 | - } |
|
27 | + public function login(Request $request): JsonResponse |
|
28 | + { |
|
29 | + if (UserFacade::loginUser($request) !== null) { |
|
30 | + if (UserFacade::getUser()->isBanned) { |
|
31 | + return $this->sendBanMessage($request); |
|
32 | + } |
|
33 | 33 | |
34 | - return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
35 | - } |
|
34 | + return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
35 | + } |
|
36 | 36 | |
37 | - //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
38 | - return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
39 | - } |
|
37 | + //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
38 | + return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * Return the Ban Message. |
43 | 43 | * |
44 | 44 | * @return JsonResponse |
45 | 45 | */ |
46 | - protected function sendBanMessage(): JsonResponse |
|
47 | - { |
|
48 | - return response()->json(['message' => 'login.user_banned', |
|
49 | - 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
50 | - 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
46 | + protected function sendBanMessage(): JsonResponse |
|
47 | + { |
|
48 | + return response()->json(['message' => 'login.user_banned', |
|
49 | + 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
50 | + 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | 54 | * Destroys the User Session. |
55 | 55 | * |
56 | 56 | * @return JsonResponse |
57 | 57 | */ |
58 | - public function logout(): JsonResponse |
|
59 | - { |
|
60 | - UserFacade::eraseSession(); |
|
58 | + public function logout(): JsonResponse |
|
59 | + { |
|
60 | + UserFacade::eraseSession(); |
|
61 | 61 | |
62 | - return response()->json(null); |
|
63 | - } |
|
62 | + return response()->json(null); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
65 | + /** |
|
66 | 66 | * Register an User on the Database |
67 | 67 | * and do the Login of the User. |
68 | 68 | * |
@@ -70,58 +70,58 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return JsonResponse |
72 | 72 | */ |
73 | - public function register(Request $request): JsonResponse |
|
74 | - { |
|
75 | - if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
76 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
77 | - } |
|
73 | + public function register(Request $request): JsonResponse |
|
74 | + { |
|
75 | + if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
76 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
77 | + } |
|
78 | 78 | |
79 | - $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
79 | + $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
80 | 80 | |
81 | - (new AccountController())->createUser($request, $request->json()->all(), true); |
|
81 | + (new AccountController())->createUser($request, $request->json()->all(), true); |
|
82 | 82 | |
83 | - (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
83 | + (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
84 | 84 | |
85 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
85 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
86 | 86 | |
87 | - return response()->json(UserFacade::getUser()); |
|
88 | - } |
|
87 | + return response()->json(UserFacade::getUser()); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
90 | + /** |
|
91 | 91 | * Create or Login a Facebook User. |
92 | 92 | * |
93 | 93 | * @param Request $request |
94 | 94 | * |
95 | 95 | * @return JsonResponse |
96 | 96 | */ |
97 | - public function facebook(Request $request): JsonResponse |
|
98 | - { |
|
99 | - $fbUser = $this->fbAuth($request); |
|
97 | + public function facebook(Request $request): JsonResponse |
|
98 | + { |
|
99 | + $fbUser = $this->fbAuth($request); |
|
100 | 100 | |
101 | - if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
102 | - return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
103 | - } |
|
101 | + if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
102 | + return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
103 | + } |
|
104 | 104 | |
105 | - (new AccountController())->createUser($request, ['email' => $fbUser->getEmail()], true); |
|
105 | + (new AccountController())->createUser($request, ['email' => $fbUser->getEmail()], true); |
|
106 | 106 | |
107 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
107 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
108 | 108 | |
109 | - return response()->json(UserFacade::getUser()); |
|
110 | - } |
|
109 | + return response()->json(UserFacade::getUser()); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
112 | + /** |
|
113 | 113 | * Do Facebook Authentication. |
114 | 114 | * |
115 | 115 | * @param Request $request |
116 | 116 | * |
117 | 117 | * @return GraphUser |
118 | 118 | */ |
119 | - protected function fbAuth(Request $request): GraphUser |
|
120 | - { |
|
121 | - $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
119 | + protected function fbAuth(Request $request): GraphUser |
|
120 | + { |
|
121 | + $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
122 | 122 | |
123 | - $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
123 | + $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
124 | 124 | |
125 | - return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
126 | - } |
|
125 | + return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
126 | + } |
|
127 | 127 | } |
@@ -1,64 +1,64 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class ShopCategory. |
7 | 7 | */ |
8 | -class ShopCategory extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class ShopCategory 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 = 'chocolatey_shop_items_categories'; |
|
22 | + protected $table = 'chocolatey_shop_items_categories'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Primary Key of the Table. |
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $primaryKey = 'category_name'; |
|
29 | + protected $primaryKey = 'category_name'; |
|
30 | 30 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * The Appender(s) of the Model. |
33 | 33 | * |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $appends = ['category']; |
|
36 | + protected $appends = ['category']; |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * Store an Shop Country. |
40 | 40 | * |
41 | 41 | * @param string $categoryName |
42 | 42 | * |
43 | 43 | * @return ShopCategory |
44 | 44 | */ |
45 | - public function store(string $categoryName): ShopCategory |
|
46 | - { |
|
47 | - $this->attributes['category_name'] = $categoryName; |
|
48 | - $this->timestamps = false; |
|
45 | + public function store(string $categoryName): ShopCategory |
|
46 | + { |
|
47 | + $this->attributes['category_name'] = $categoryName; |
|
48 | + $this->timestamps = false; |
|
49 | 49 | |
50 | - $this->save(); |
|
50 | + $this->save(); |
|
51 | 51 | |
52 | - return $this; |
|
53 | - } |
|
52 | + return $this; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
55 | + /** |
|
56 | 56 | * Get Shop Category Name. |
57 | 57 | * |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public function getCategoryAttribute(): string |
|
61 | - { |
|
62 | - return $this->attributes['category_name']; |
|
63 | - } |
|
60 | + public function getCategoryAttribute(): string |
|
61 | + { |
|
62 | + return $this->attributes['category_name']; |
|
63 | + } |
|
64 | 64 | } |
@@ -1,34 +1,34 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class Ban. |
7 | 7 | */ |
8 | -class Ban extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class Ban 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 = 'bans'; |
|
22 | + protected $table = 'bans'; |
|
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 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * Store an User Ban. |
33 | 33 | * |
34 | 34 | * @param int $userId |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return Ban |
43 | 43 | */ |
44 | - public function store(int $userId, int $userStaffId, string $banReason, $banType = 'account', $banExpire = 0, $ipAddress = '', $machineId = ''): Ban |
|
45 | - { |
|
46 | - $this->attributes['user_id'] = $userId; |
|
47 | - $this->attributes['user_staff_id'] = $userStaffId; |
|
48 | - $this->attributes['ban_reason'] = $banReason; |
|
49 | - $this->attributes['ban_expire'] = $banExpire; |
|
50 | - $this->attributes['timestamp'] = time(); |
|
51 | - $this->attributes['ip'] = $ipAddress; |
|
52 | - $this->attributes['type'] = $banType; |
|
53 | - $this->attributes['machine_id'] = $machineId; |
|
54 | - $this->timestamps = false; |
|
44 | + public function store(int $userId, int $userStaffId, string $banReason, $banType = 'account', $banExpire = 0, $ipAddress = '', $machineId = ''): Ban |
|
45 | + { |
|
46 | + $this->attributes['user_id'] = $userId; |
|
47 | + $this->attributes['user_staff_id'] = $userStaffId; |
|
48 | + $this->attributes['ban_reason'] = $banReason; |
|
49 | + $this->attributes['ban_expire'] = $banExpire; |
|
50 | + $this->attributes['timestamp'] = time(); |
|
51 | + $this->attributes['ip'] = $ipAddress; |
|
52 | + $this->attributes['type'] = $banType; |
|
53 | + $this->attributes['machine_id'] = $machineId; |
|
54 | + $this->timestamps = false; |
|
55 | 55 | |
56 | - $this->save(); |
|
56 | + $this->save(); |
|
57 | 57 | |
58 | - return $this; |
|
59 | - } |
|
58 | + return $this; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
61 | + /** |
|
62 | 62 | * Get Ban Expire Attribute. |
63 | 63 | * |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public function getBanExpireAttribute(): string |
|
67 | - { |
|
68 | - return date('M/d/Y h:m A', $this->attributes['ban_expire']); |
|
69 | - } |
|
66 | + public function getBanExpireAttribute(): string |
|
67 | + { |
|
68 | + return date('M/d/Y h:m A', $this->attributes['ban_expire']); |
|
69 | + } |
|
70 | 70 | } |