title: Get Set Global Variable to use in another function
body: <p>My main idea is passing data with session and get or set with controller to use in model.</p>
  
  <p>This is my <strong>Controller</strong>.</p>
  
  <pre><code>$aFilters = $request-&gt;all();
  
  if(empty($aFilters)) {
  
      $aRegions = $this-&gt;oChartManager-&gt;getRegions();
      $aFilterRegion = [];
      foreach ($aRegions as $aRegion) {
          array_push($aFilterRegion, $aRegion['region']);
      }
      $aFilters['region'] = $aFilterRegion;
  
  }
  
  $request-&gt;session()-&gt;put('filtered', $aFilters);
  
  $request-&gt;session()-&gt;put('filtered', $this-&gt;oChartManager-&gt;addGlobalFilters('region', $aFilters['region']));
  
  $request-&gt;session()-&gt;put('filtered', $this-&gt;oChartManager-&gt;getGlobalFilters());
  </code></pre>
  
  <p>This is my <strong>Model</strong>.</p>
  
  <pre><code>protected $aGlobalFilters = [];
  
  public function addGlobalFilters($sKey, $mValue) {
  
      $this-&gt;aGlobalFilters[$sKey] = $mValue;
  }
  
  public function getGlobalFilters() {
  
      return $this-&gt;aGlobalFilters;
  }
  
  public function Info() {
  
       dd($this-&gt;aGlobalFilters ); // This get [] 
  }
  </code></pre>
  
  <p>The Problem is i try to get data from controller to use in another function but the data not passing to function Info even i return in <code>getGlobalFilters()</code> function.</p>