<?php
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class RedirectUsuarioToPortal
{
    public function handle(Request $request, Closure $next)
    {
        if (auth()->check() && auth()->user()->hasRole('usuario')) {
            return redirect()->route('portal.index');
        }
        return $next($request);
    }
}
