title: how to display an array on view page after running function returning to same page
body: <p>i have a page called "grapghhehe" and in that page i have a bar chart and a form for user to select 2 dates(from and to) so when user selects this 2 dates it suppose to show the graph details based on the dates only.. so what i have done where it will return the data which is correct in an array like:</p>
  
  <pre><code>array:3 [
    0 =&gt; 1
    1 =&gt; 17
    2 =&gt; 1
  ]
  array:1 [
    0 =&gt; 3
  ]
  array:4 [
    0 =&gt; 1
    1 =&gt; 2
    2 =&gt; 1
    3 =&gt; 1
  ]
  </code></pre>
  
  <p>so as you can they are 3 arrays for 3 different values... now i want to return this data on the same page. how can i do that? my code so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public function graphheheByDate(Request $request, $companyID)
  {
  $companyID = $this-&gt;decode($companyID);
  
  $match = DiraChatLog::where('status','=','Match')-&gt;where('date_access', '&gt;=', $request-&gt;from)-&gt;where('date_access', '&lt;=', $request-&gt;to)
  -&gt;selectRaw('DATE(date_access) as date, COUNT(1) as cnt') // created_at here is datetime format, only need the date portion using `DATE` function
  -&gt;orderBy("date")
  -&gt;groupBy("date")
  -&gt;get() // return result set (collection) from query builder
  -&gt;pluck('cnt') // only need the cnt column
  -&gt;values() // array_values
  -&gt;sum(); // convert collection to array
  
  $missing = DiraChatLog::where('status','=','Missing')-&gt;where('date_access', '&gt;=', $request-&gt;from)-&gt;where('date_access', '&lt;=', $request-&gt;to)
  -&gt;selectRaw('DATE(date_access) as date, COUNT(1) as cnt') // created_at here is datetime format, only need the date portion using `DATE` function
  -&gt;orderBy("date")
  -&gt;groupBy("date")
  -&gt;get() // return result set (collection) from query builder
  -&gt;pluck('cnt') // only need the cnt column
  -&gt;values() // array_values
  -&gt;sum(); // convert collection to array
  
  $noAnswer = DiraChatLog::where('status','=','No Answer')-&gt;where('date_access', '&gt;=', $request-&gt;from)-&gt;where('date_access', '&lt;=', $request-&gt;to)
  -&gt;selectRaw('DATE(date_access) as date, COUNT(1) as cnt') // created_at here is datetime format, only need the date portion using `DATE` function
  -&gt;orderBy("date")
  -&gt;groupBy("date")
  -&gt;get() // return result set (collection) from query builder
  -&gt;pluck('cnt') // only need the cnt column
  -&gt;values() // array_values
  -&gt;sum(); // convert collection to array
  
  $match = array(0 =&gt; $match);
  $missing = array(0 =&gt; $missing);
  $noAnswer = array(0 =&gt; $noAnswer);
  // dd($match,$missing,$noAnswer);
  
  $from = $request-&gt;from;
  $to = $request-&gt;to;
  // dd($from, $to);
  
  $companyID = $this-&gt;encodeID($companyID);
  
  return view('AltHr.Chatbot.graphhehe', compact('companyID','from','to'))-&gt;with('match',json_encode($match,JSON_NUMERIC_CHECK))-&gt;with('missing',json_encode($missing,JSON_NUMERIC_CHECK))-&gt;with('noAnswer',json_encode($noAnswer,JSON_NUMERIC_CHECK));     
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>in this function when i dd the 3 values are correct details. i only want this data to bring to the same page to change the graph.</p>
  
  <p>my graph javascript is as below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://code.highcharts.com/highcharts.js"&gt;&lt;/script&gt;
  &lt;script src="https://code.highcharts.com/modules/exporting.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
    var match = &lt;?php echo $match; ?&gt;;
    var missing = &lt;?php echo $missing; ?&gt;;
    var noAnswer = &lt;?php echo $noAnswer; ?&gt;;
  
    Highcharts.chart('container', {
      chart: {
          type: 'column'
      },
      title: {
          text: 'Unique Visitors'
      },
      subtitle: {
          text: ''
      },
      xAxis: {
          categories: [
              'Dates'
          ],
          crosshair: true
      },
      yAxis: {
          min: 0,
          title: {
              text: 'Total'
          }
      },
      credits: {
        enabled: false
      },
      exporting: {
        enabled: false
      },
      tooltip: {
          headerFormat: '&lt;span&gt;{point.key}&lt;/span&gt;&lt;table&gt;',
          pointFormat: '&lt;tr&gt;&lt;td style="color:{series.color};padding:0"&gt;{series.name}: &lt;/td&gt;' +
              '&lt;td style="padding:0"&gt;&lt;b&gt;{point.y}&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;',
          footerFormat: '&lt;/table&gt;',
          shared: true,
          useHTML: true
      },
      plotOptions: {
          column: {
              pointPadding: 0.2,
              borderWidth: 0
          }
      },
      series: [{
          name: 'Match',
          data: [match]
  
      }, {
          name: 'Missing',
          data: [missing]
  
      }, {
          name: 'No Answer',
          data: [noAnswer]
  
      }]
  });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>