diff --git a/app/Http/Controllers/Training/ApplicationsController.php b/app/Http/Controllers/Training/ApplicationsController.php index 623ad815..e7553e67 100644 --- a/app/Http/Controllers/Training/ApplicationsController.php +++ b/app/Http/Controllers/Training/ApplicationsController.php @@ -57,8 +57,8 @@ public function apply(Request $request) return view('training.applications.apply')->with('allowed', 'rating'); } + // Redirect if user is not a member of the Discord if(auth()->user()->member_of_czqo == 0){ - return view('training.applications.apply')->with('allowed', 'discord'); } diff --git a/app/Jobs/DiscordAccountCheck.php b/app/Jobs/DiscordAccountCheck.php index 57b1300f..451ab1cd 100644 --- a/app/Jobs/DiscordAccountCheck.php +++ b/app/Jobs/DiscordAccountCheck.php @@ -23,7 +23,7 @@ class DiscordAccountCheck implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public $timeout = 1400; + public $timeout = 3000; /** * Execute the job. @@ -34,7 +34,7 @@ class DiscordAccountCheck implements ShouldQueue public function handle() { // Timeout length (seconds) - ini_set('max_execution_time', 1400); + ini_set('max_execution_time', 3000); // Script Start Time $start_time = Carbon::now(); @@ -73,7 +73,7 @@ public function handle() } // Add a Sleep Timer - Allows API to not block - sleep(6); + sleep(2); // Check if user is currently in Discord if (in_array($user->discord_user_id, $discord_uids)) { @@ -144,6 +144,16 @@ public function handle() array_push($rolesToAdd, $discordRoleIds['shanwick_certified']); } + //Enroute Controller + if($user->rating_short == 'C1'){ + array_push($rolesToAdd, $discordRoleIds['enroute']); + } + + //Enroute Controller + if($user->rating_short == 'C3'){ + array_push($rolesToAdd, $discordRoleIds['senior_enroute']); + } + //Supervisor? if ($user->rating_short == 'SUP') { array_push($rolesToAdd, $discordRoleIds['supervisor']);