<?php

namespace App\Http\Middleware\Software;

use Closure;

class SoftwareMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(auth()->user()->getRole() === 'swc')
            return $next($request);
        else {
            return redirect()->route('home');
        }
    }
}
