public function check(Request $request)
    {
        $request->validate(['code' => 'required|numeric']);

        if (Hash::check($request->code, $this->getHash())) {
            session(['can_visit' => true]);

            return response([
                'status' => 'success',
            ]);
        }

        $this->incrementLoginAttempts($request);

        if ($this->hasTooManyLoginAttempts($request) && $this->throttleIsActive()) {
            return response([
                'too_many_attempts' => true,
                'seconds_message'  => TransFormer::transform($this->getBlockedSeconds($request), $this->config['seconds_message']),
            ], 401);
        }

        return response([
            'too_many_attempts' => false,
            'attempts_left'    => $this->showAttempts($request),
        ], 401);
    }
public function check(Request $request)
    {
        $request->validate(['code' => 'required|numeric']);

        if (Hash::check($request->code, $this->getHash())) {
            session(['can_visit' => true]);

            return response([
                'status' => 'success',
            ]);
        }

        $this->incrementLoginAttempts($request);

        if ($this->hasTooManyLoginAttempts($request) && $this->throttleIsActive()) {
            return response([
                'too_many_attempts' => true,
                'seconds_message'  => TransFormer::transform($this->getBlockedSeconds($request), $this->config['seconds_message']),
            ], 401);
        }

        return response([
            'too_many_attempts' => false,
            'attempts_left'    => $this->showAttempts($request),
        ], 401);
    }
public function check ( Request $ request ) { $ request -> validate ( [ 'code' => 'required|numeric' ] ) ; if ( Hash :: check ( $ request -> code , $ this -> getHash ( ) ) ) { session ( [ 'can_visit' => true ] ) ; return response ( [ 'status' => 'success' , ] ) ; } $ this -> incrementLoginAttempts ( $ request ) ; if ( $ this -> hasTooManyLoginAttempts ( $ request ) && $ this -> throttleIsActive ( ) ) { return response ( [ 'too_many_attempts' => true , 'seconds_message' => TransFormer :: transform ( $ this -> getBlockedSeconds ( $ request ) , $ this -> config [ 'seconds_message' ] ) , ] , 401 ) ; } return response ( [ 'too_many_attempts' => false , 'attempts_left' => $ this -> showAttempts ( $ request ) , ] , 401 ) ; }
Check if the given code is correct,
then return the proper response.

@param Request $request

@throws Exception

@return \Symfony\Component\HttpFoundation\Response
Check if the given code is correct then return the proper response .