<?php

namespace App\Http\Middleware;

use Closure;

class CheckInstallationStep
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $installation_step = setting('app_installation_step',5);
        if ($installation_step == 1) {
            return redirect('base/installation/step-1');
        }elseif ($installation_step == 2) {
            return redirect('base/installation/step-2');
        }elseif ($installation_step == 3) {
            return redirect('base/installation/step-3');
        }elseif ($installation_step == 4) {
            return redirect('base/installation/step-4');
        }

        return $next($request);
    }
}
