refactor: adopt if helpers

- Collapse multiline if statements by adopting Laravel’s abort_if and throw_if helpers.
This commit is contained in:
HDVinnie
2022-05-26 21:56:23 -04:00
parent d5595c45d8
commit 9abcb90533
7 changed files with 43 additions and 117 deletions
@@ -92,9 +92,7 @@ class TwoStepController extends Controller
*/
public function showVerification(): \Illuminate\Contracts\View\View
{
if (! \config('auth.TwoStepEnabled')) {
\abort(404);
}
abort_if(! \config('auth.TwoStepEnabled'), \404);
$twoStepAuth = $this->twoStepAuth;
$authStatus = $this->authStatus;
@@ -147,9 +145,7 @@ class TwoStepController extends Controller
*/
public function verify(Request $request): ?\Illuminate\Http\JsonResponse
{
if (! \config('auth.TwoStepEnabled')) {
\abort(404);
}
abort_if(! \config('auth.TwoStepEnabled'), \404);
if ($request->ajax()) {
$validator = \validator($request->all(), [
@@ -192,9 +188,7 @@ class TwoStepController extends Controller
*/
public function resend(): \Illuminate\Http\JsonResponse
{
if (! \config('auth.TwoStepEnabled')) {
\abort(404);
}
abort_if(! \config('auth.TwoStepEnabled'), \404);
$twoStepAuth = $this->twoStepAuth;
$this->sendVerificationCodeNotification($twoStepAuth);