I try to determine a global variable in template blade:
global $result_view;
Below this I try call this:
<?=$result_view?>
And get error: Undefined variable: result_view ()
I try to determine a global variable in template blade:
global $result_view;
Below this I try call this:
<?=$result_view?>
And get error: Undefined variable: result_view ()
In Controller or Service provider , you can add
View::share('result_view', 'SomeValue');
in any Blade template in your project you can use,
{{ $result_view }}
One way to do it is to define your variable in a config file and then you'll be able to get this var in all views, controllers etc.
{{ config('myConfig.someVariable') }}
Also, you can use view composer to set global variable.