public function printReady($id)
 {
     $si = ServiceInspection::query()->find($id);
     $si->jsonDecode();
     $user = $si->user;
     $inspectedByFirst = $user->firstName;
     $inspectedByLast = $user->lastName;
     return PDF::loadView('pages.inspection.formPrintReady', ['si' => $si, 'inspectedByFirst' => $inspectedByFirst, 'inspectedByLast' => $inspectedByLast])->stream();
 }
 public function sendEmail(Request $request, $id)
 {
     $si = ServiceEstimate::query()->find($id);
     $user = $si->user;
     $email = $request->get('email');
     $inspectedByFirst = $user->firstName;
     $inspectedByLast = $user->lastName;
     $data = array('firstName' => $si->firstName, 'lastName' => $si->lastName, 'workOrder' => $si->workOrder, 'comments' => $request->get('emailComments'));
     $user = Auth::user();
     $pdf = PDF::loadView('pages.serviceestimate.formPrintCustomer', ['si' => $si, 'inspectedByFirst' => $inspectedByFirst, 'inspectedByLast' => $inspectedByLast]);
     Mail::send('emails.estimate', $data, function ($message) use($pdf) {
         $message->from('*****@*****.**', 'Service Portal');
         $message->to('*****@*****.**')->subject('Your Service Estimate');
         $message->attachData($pdf->output(), "estimate.pdf");
     });
 }
 public function generatePdf($id)
 {
     $data['service'] = Service::find($id);
     $pdf = PDF::loadView('services/pdf', $data);
     return $pdf->stream();
 }