Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. public function create(Request $request)
  2. {
  3.  
  4. $recy = Recyclable::whereBetween('recycled_on', [$request->search1,$request->search2])->get();
  5.  
  6. $comp = Composing::whereBetween('composted_on', [$request->search1,$request->search2])->get();
  7.  
  8. $resi = Disposal::whereBetween('disposed_on', [$request->search1,$request->search2])->get();
  9.  
  10. $disposecollect = Disposecollect::where(DB::raw("(DATE_FORMAT(created_at, '%Y'))"),date('Y'))->get();
  11. $totals = Charts::database($disposecollect,'bar','highcharts')
  12. ->title('ESWM Data')
  13. ->elementLabel("Total Weight in KGS")
  14. ->labels(['Recyclables','Compostables','Residuals'])
  15. ->dimensions(1000, 500)
  16. ->values([ $recy->sum('weight'), $comp->sum('weight'), $resi->sum('weight')])
  17. ->colors(["blue", "green", "gray"])
  18. ->responsive(false);
  19.  
  20. // Send data to the view using loadView function of PDF facade
  21. $pdf = PDF::loadView('totalspdf', compact('totals'));
  22. // If you want to store the generated pdf to the server then you can use the store function
  23. $pdf->save(storage_path().'_filename.pdf');
  24. // Finally, you can download the file using download function
  25. return $pdf->download('overallreport.pdf');
  26.  
  27. }
  28.  
  29. <!DOCTYPE html>
  30. <html>
  31. <head>
  32. <h1 align="center">ECOTENEO</h1>
  33. </head>
  34. <body>
  35. <h3 align="center">Overall Collection Graph</h3>
  36. <br>
  37.  
  38. {!! $totals->render() !!}
  39.  
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement