<?php

namespace App\Http\Middleware;

use App\Enums\UserStatus;
use Closure;
use Illuminate\Http\Request;

class ActiveAccountMiddleware
{
    public function handle(Request $request, Closure $next)
    {
        if (auth()->user()->status !== UserStatus::Active) {
            return redirect()->route('pending');
        }

        return $next($request);
    }
}
