<?php

namespace Sargilla\Flatlab4\Middlewares;

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

class GuestUser
{
    public function handle(Request $request, Closure $next)
    {
        view()->share('logueado', Auth::check());
        view()->share('user', Auth::user() ?: new \Sargilla\Flatlab4\GuestUser);

        return $next($request);
    }
}
