<?php

namespace App\Domains\Sms\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use App\Exceptions\AuthException;
use App\Domains\Sms\Services\SmsService;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class VerifyCodeAuthenticate
{
    public function handle(Request $request, Closure $next)
    {
        $mobile = $request->get('mobile', '');

        $verifyCode = $request->get('verify_code', '');

        app(SmsService::class)->verifyCode($mobile, $verifyCode);

        return $next($request);
    }
}
