Example of View composers in range-of-motion/budget

File app/Providers/AppServiceProvider.php (link to Github)
use App\Helper;
use App\Models\Space;
use Illuminate\Support\ServiceProvider;
use Auth;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        view()->composer('*', function ($view) {
            $selectedSpace = session('space_id') ? Space::find(session('space_id')) : null;

            $versionFileExists = file_exists(base_path() . '/version.txt');
            $versionNumber = $versionFileExists ? file_get_contents(base_path() . '/version.txt') : '-';

            $view->with([
                'userName' => Auth::check() ? Auth::user()->name : null,
                'currency' => $selectedSpace ? $selectedSpace->currency->symbol : '-',
                'selectedSpace' => $selectedSpace,
                'arePlansEnabled' => Helper::arePlansEnabled(),
                'suggestionBoxEnabled' => env('SUGGESTION_BOX_ENABLED', false),
                'versionNumber' => $versionNumber
            ]);
        });
    }
    //
}
File resources/views/layout.blade.php (link to Github)
//
                    @if ($suggestionBoxEnabled)
                        <a class="fs-sm" href="/ideas/create">{{ __('general.got_a_suggestion') }}?</a> &middot; {{ $versionNumber }}
                    @else
                        {{ $versionNumber }}
                    @endif
//

Additional resources on view composers: