<?php

namespace Televox\Http\Middleware;

use Closure;

class CheckUserIsNotLogged
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        if ($request->session()->has('logueado')) {

            return $next($request);
        } else {
            return redirect(config('app.url') . '/login');
        }
    }
}
