diff --git a/app/Classes/Pterodactyl.php b/app/Classes/Pterodactyl.php index 1904ed8f..710fbb12 100644 --- a/app/Classes/Pterodactyl.php +++ b/app/Classes/Pterodactyl.php @@ -14,6 +14,11 @@ use Illuminate\Support\Facades\Http; class Pterodactyl { + /** + * @description per_page option to pull more than the default 50 from pterodactyl + */ + public CONST PER_PAGE = 200; + //TODO: Extend error handling (maybe logger for more errors when debugging) /** @@ -43,7 +48,7 @@ class Pterodactyl */ public static function getEggs(Nest $nest) { - $response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables"); + $response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . self::PER_PAGE); if ($response->failed()) throw self::getException(); return $response->json()['data']; } @@ -54,7 +59,7 @@ class Pterodactyl */ public static function getNodes() { - $response = self::client()->get('/application/nodes'); + $response = self::client()->get('/application/nodes?per_page=' . self::PER_PAGE); if ($response->failed()) throw self::getException(); return $response->json()['data']; } @@ -65,7 +70,7 @@ class Pterodactyl */ public static function getNests() { - $response = self::client()->get('/application/nests'); + $response = self::client()->get('/application/nests?per_page=' . self::PER_PAGE); if ($response->failed()) throw self::getException(); return $response->json()['data']; } @@ -76,7 +81,7 @@ class Pterodactyl */ public static function getLocations() { - $response = self::client()->get('/application/locations'); + $response = self::client()->get('/application/locations?per_page=' . self::PER_PAGE); if ($response->failed()) throw self::getException(); return $response->json()['data']; } diff --git a/app/Http/Controllers/Auth/SocialiteController.php b/app/Http/Controllers/Auth/SocialiteController.php index c70a21c5..aa8b93c2 100644 --- a/app/Http/Controllers/Auth/SocialiteController.php +++ b/app/Http/Controllers/Auth/SocialiteController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Models\Configuration; use App\Models\DiscordUser; +use App\Models\User; use App\Models\Voucher; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Http; @@ -27,14 +28,15 @@ class SocialiteController extends Controller return abort(500); } + /** @var User $user */ + $user = Auth::user(); $discord = Socialite::driver('discord')->user(); - $discordUser = DiscordUser::find($discord->id); $botToken = env('DISCORD_BOT_TOKEN'); $guildId = env('DISCORD_GUILD_ID'); $roleId = env('DISCORD_ROLE_ID'); //save / update discord_users - if (is_null($discordUser)) { + if (is_null($user->discordUser)) { //create discord user in db DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id])); //update user @@ -42,7 +44,7 @@ class SocialiteController extends Controller Auth::user()->increment('server_limit', Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD')); Auth::user()->update(['discord_verified_at' => now()]); } else { - $discordUser->update($discord->user); + $user->discordUser->update($discord->user); } //force user into discord server diff --git a/resources/views/profile/index.blade.php b/resources/views/profile/index.blade.php index 75f2d1a0..4423691e 100644 --- a/resources/views/profile/index.blade.php +++ b/resources/views/profile/index.blade.php @@ -78,9 +78,12 @@ class="pt-sm-2 pb-1 mb-0 text-nowrap">{{$user->name}}
{{$user->email}} @if($user->hasVerifiedEmail()) - + @else - + @endif
@@ -189,8 +192,8 @@ @if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET')))You are verified!
{{$user->discordUser->id}} -
-