refactor: remove useless check for existence

Route model binding already returns a 404 if a model is not found through its ID, thus rendering the code performing that validation useless.

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
Miguel Nogueira 2022-11-08 00:36:07 +00:00
parent f43ff4e9a0
commit 81d995cfc7
No known key found for this signature in database
GPG Key ID: 3C6A7E29AF26D370

View File

@ -56,23 +56,17 @@ class ApplicationController extends Controller
{
$this->authorize('view', $application);
if (!is_null($application)) {
return view('dashboard.user.viewapp')
->with(
[
'application' => $application,
'comments' => $application->comments,
'structuredResponses' => json_decode($application->response->responseData, true),
'formStructure' => $application->response->form,
'vacancy' => $application->response->vacancy,
'canVote' => $this->applicationService->canVote($application->votes),
]
);
} else {
$request->session()->flash('error', __('The application you requested could not be found.'));
}
return redirect()->back();
return view('dashboard.user.viewapp')
->with(
[
'application' => $application,
'comments' => $application->comments,
'structuredResponses' => json_decode($application->response->responseData, true),
'formStructure' => $application->response->form,
'vacancy' => $application->response->vacancy,
'canVote' => $this->applicationService->canVote($application->votes),
]
);
}