feat: require that users link their discord to apply to certain vacancies
Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Exceptions\DiscordAccountRequiredException;
|
||||
use App\Notifications\ApplicationConfirmed;
|
||||
use ContextAwareValidator;
|
||||
use App\Application;
|
||||
@@ -22,12 +23,18 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ApplicationService
|
||||
{
|
||||
/**
|
||||
* @throws DiscordAccountRequiredException
|
||||
*/
|
||||
public function renderForm($vacancySlug)
|
||||
{
|
||||
$vacancyWithForm = Vacancy::with('forms')->where('vacancySlug', $vacancySlug)->get();
|
||||
|
||||
$firstVacancy = $vacancyWithForm->first();
|
||||
|
||||
if ($firstVacancy->requiresDiscord && !Auth::user()->hasDiscordConnection()) {
|
||||
throw new DiscordAccountRequiredException('A discord account is required beyond this point.');
|
||||
}
|
||||
|
||||
if (!$vacancyWithForm->isEmpty() && $firstVacancy->vacancyCount !== 0 && $firstVacancy->vacancyStatus == 'OPEN') {
|
||||
return view('dashboard.application-rendering.apply')
|
||||
->with([
|
||||
|
Reference in New Issue
Block a user