<?php

namespace twa\ecomauth\middleware;

use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
use Closure;
use twa\apilibs\traits\APITrait;

class AuthenticationVerificationRequiredCheck extends Middleware
{
    /**
     * The URIs that should be reachable while maintenance mode is enabled.
     *
     * @var array
     */
    use APITrait;
    protected $except = [
        //
    ];

    public function handle($request, Closure $next)
    {     $config=Config('ecom-auth');

//            if(request()->user['login']){
//                if(in_array('phone',$config['auth_types'])){
//                    if(isset(request()->user['user']['mobile_verification']) && request()->user['user']['mobile_verification']==0){
//                        return redirect()->route('verification-link-fallback',['type'=>'phone']);
//                    }
//                }
//                if(in_array('email',$config['auth_types'])){
//                    if(isset(request()->user['user']['verified']) && request()->user['user']['verified']==0){
//                        return redirect()->route('verification-link-fallback',['type'=>'email']);
//                    }
//                }
//
//                    return $next($request);
//
//            }


        return $next($request);
    }
}
