. */ namespace App\Http\Middleware; use App\Services\Session\Constants; use Closure; use Illuminate\Http\Request; /** * Class ReadyForImport */ class ReadyForImport { /** * Check if the user has already set the mapping in this session. If so, continue to configuration. * * @param Request $request * @param Closure $next * * @return mixed * */ public function handle(Request $request, Closure $next) { if (session()->has(Constants::MAPPING_COMPLETE_INDICATOR) && true === session()->get(Constants::MAPPING_COMPLETE_INDICATOR)) { return $next($request); } echo 'Import is not yet ready.'; exit; } }