Global variable in laravel not working after upgrading 7 to 8

  laravel, php

I upgraded the laravel from 7 to 8 and it works very well except for the global variables.
this is my sample:

View::composer('*', function ($view) {
    $contact = AppContact::all();
    $topbar = AppTopbar::orderBy('sortorder', 'asc')->get();

    $view->with('contact',$contact)
    ->with('topbar',$topbar);

});

you can find this code in official docs:
https://laravel.com/docs/8.x/views

Source: Laravel

Leave a Reply