Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function create(Request $request)
- {
- $recy = Recyclable::whereBetween('recycled_on', [$request->search1,$request->search2])->get();
- $comp = Composing::whereBetween('composted_on', [$request->search1,$request->search2])->get();
- $resi = Disposal::whereBetween('disposed_on', [$request->search1,$request->search2])->get();
- $disposecollect = Disposecollect::where(DB::raw("(DATE_FORMAT(created_at, '%Y'))"),date('Y'))->get();
- $totals = Charts::database($disposecollect,'bar','highcharts')
- ->title('ESWM Data')
- ->elementLabel("Total Weight in KGS")
- ->labels(['Recyclables','Compostables','Residuals'])
- ->dimensions(1000, 500)
- ->values([ $recy->sum('weight'), $comp->sum('weight'), $resi->sum('weight')])
- ->colors(["blue", "green", "gray"])
- ->responsive(false);
- // Send data to the view using loadView function of PDF facade
- $pdf = PDF::loadView('totalspdf', compact('totals'));
- // If you want to store the generated pdf to the server then you can use the store function
- $pdf->save(storage_path().'_filename.pdf');
- // Finally, you can download the file using download function
- return $pdf->download('overallreport.pdf');
- }
- <!DOCTYPE html>
- <html>
- <head>
- <h1 align="center">ECOTENEO</h1>
- </head>
- <body>
- <h3 align="center">Overall Collection Graph</h3>
- <br>
- {!! $totals->render() !!}
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement