refactor: code style changes
Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
@@ -29,23 +29,19 @@ use App\Exceptions\IncompleteApplicationException;
|
||||
use App\Exceptions\InvalidAgeException;
|
||||
use App\Exceptions\UnavailableApplicationException;
|
||||
use App\Exceptions\VacancyNotFoundException;
|
||||
use App\Facades\IP;
|
||||
use App\Services\ApplicationService;
|
||||
use App\Vacancy;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ApplicationController extends Controller
|
||||
{
|
||||
|
||||
private $applicationService;
|
||||
|
||||
public function __construct(ApplicationService $applicationService) {
|
||||
|
||||
public function __construct(ApplicationService $applicationService)
|
||||
{
|
||||
$this->applicationService = $applicationService;
|
||||
}
|
||||
|
||||
|
||||
public function showUserApps()
|
||||
{
|
||||
return view('dashboard.user.applications')
|
||||
@@ -67,7 +63,6 @@ class ApplicationController extends Controller
|
||||
'canVote' => $this->applicationService->canVote($application->votes),
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function showAllApps(Request $request)
|
||||
@@ -76,42 +71,36 @@ class ApplicationController extends Controller
|
||||
|
||||
return view('dashboard.appmanagement.all')
|
||||
->with('applications', Application::orderBy('applicationStatus', 'ASC')->paginate(6));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function discordApply(Request $request, $vacancySlug) {
|
||||
|
||||
public function discordApply(Request $request, $vacancySlug)
|
||||
{
|
||||
$request->session()->put('discordApplicationRedirectedSlug', $vacancySlug);
|
||||
return redirect(route('discordRedirect'));
|
||||
|
||||
return redirect(route('discordRedirect'));
|
||||
}
|
||||
|
||||
public function renderApplicationForm($vacancySlug)
|
||||
{
|
||||
try {
|
||||
return $this->applicationService->renderForm($vacancySlug);
|
||||
}
|
||||
catch (ApplicationNotFoundException $ex) {
|
||||
} catch (ApplicationNotFoundException $ex) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', $ex->getMessage());
|
||||
|
||||
} catch (DiscordAccountRequiredException $e) {
|
||||
\Log::info('Redirecting user: ' . $e->getMessage(), [
|
||||
'user' => Auth::user()->email
|
||||
\Log::info('Redirecting user: '.$e->getMessage(), [
|
||||
'user' => Auth::user()->email,
|
||||
]);
|
||||
|
||||
request()->session()->put('discordApplicationRedirectedSlug', $vacancySlug);
|
||||
|
||||
return redirect(route('discordRedirect'));
|
||||
} catch (IncompatibleAgeException $e) {
|
||||
|
||||
return redirect()
|
||||
->to(route('dashboard'))
|
||||
->with('error', $e->getMessage());
|
||||
|
||||
} catch (InvalidAgeException $e) {
|
||||
|
||||
return view('dashboard.application-rendering.add-age');
|
||||
}
|
||||
}
|
||||
@@ -121,9 +110,7 @@ class ApplicationController extends Controller
|
||||
if (Auth::user()->isEligible()) {
|
||||
try {
|
||||
$this->applicationService->fillForm(Auth::user(), $request->all(), $vacancySlug);
|
||||
|
||||
} catch (VacancyNotFoundException | IncompleteApplicationException | UnavailableApplicationException $e) {
|
||||
|
||||
} catch (VacancyNotFoundException|IncompleteApplicationException|UnavailableApplicationException $e) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', $e->getMessage());
|
||||
@@ -146,8 +133,7 @@ class ApplicationController extends Controller
|
||||
|
||||
try {
|
||||
$status = $this->applicationService->updateStatus($application, $newStatus);
|
||||
} catch (\LogicException $ex)
|
||||
{
|
||||
} catch (\LogicException $ex) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', $ex->getMessage());
|
||||
@@ -170,6 +156,5 @@ class ApplicationController extends Controller
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', __('Application deleted. Comments, appointments and responses have also been deleted.'));
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user