<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class CheckManager
{
    public function handle($request, Closure $next)
    {
        if (Auth::check() && Auth::user()->user_type == 'manager') {
            return $next($request);
        }

        return redirect()->back()->with('error', 'You do not have employee access');
    }
}
