I had to declare a variable in AppServiceProvider and shared it to all view to be able to use it everywhere.
AppServiceProvider.php
//the reputation variable
$reputations = array(
'xxx'=>array('value'=>1,'description'=>'yyy')
);
view()->share([
'reputations'=>$reputations]);
now I have a helper file that has some functions also available in all views and controllers. I wish to access the $reputations variable inside Helpers.php
App\Helpers\Helpers.php
also why can I create a function inside the helper file and access it from a view, but when I declare a normal variable I can't access it from the view?