Create a global variable in laravel 5.5

1

I would like to create a global variable in laravel to be able to use it in controllers as in views; I would like to do this without having to use Session or Cache . Is there any colleagues mechanism? Investigating I realize that in AppServiceProvider I can create one like this that believes:

view()->composer('*', function($view){
            $view->with('is_lock', LockSession::isLocked());
        });

This variable that I create only serves for the views or it also helps me to call it in my controllers

    
asked by albertolg89 16.04.2018 в 18:28
source

0 answers