title: display result of function is controller inside home view blade (LARAVEL , PHP)
body: <p>i want to show the total of amount in the home view blade
  (table = payments , colon = amount)</p>
  
  <p>i tested another method by route , this it work fine but the result show in /test of course:</p>
  
  <pre><code>Route::get('/test', function(){
   $total = DB::table('payments') 
  -&gt;where('status', '=', 'success')   //this for collect only the success payments
  -&gt;sum('payments.amount'); 
  return   $total;   //  work fine the result is correct
  });
  </code></pre>
  
  <p>but my purpose is to display this result inside the home view 
  by move the function from the previous code from route to controller and call it in the view</p>
  
  <p>for the controller i have Homecontroller but the function index is aleardy used , so i create new function in this controller i try this </p>
  
  <pre><code>public function show(){
   $total = DB::table('payments') 
  -&gt;where('status', '=', 'success') 
  -&gt;sum('payments.amount'); 
  return  view('home' , $total); 
  }
  </code></pre>
  
  <p>for routing i put this </p>
  
  <pre><code>Route::get('/home', 'HomeController@show');
  </code></pre>
  
  <p>i try this inside the view but didnt work :</p>
  
  <pre><code>&lt;h1&gt;{{$total}}&lt;/h1&gt;
  </code></pre>