<?php

namespace App\View\Composers;

use Illuminate\View\View;
use Illuminate\Support\Facades\Session;

class UserViewComposer
{
    public function compose(View $view)
    {
        // Retrieve the user data from the session, default to null if not set
        $user = Session::get('user', null);

        // Share the user data with the view
        $view->with('user', $user);
    }
}