=', $reportDateFrom) ->where('created_at', '<=', gmdate('Y-m-d H:i:s')) ->count(); $totalCompleted = Booking::where('end_time', '>=', $reportDateFrom) ->where('end_time', '<=', gmdate('Y-m-d H:i:s')) ->where('status', 'completed') ->count(); if (!$totalBooked && !$totalCompleted) { return; } $data = [ 'days' => $reportDays, 'frequency' => $frequency, 'totalBooked' => $totalBooked, 'totalCompleted' => $totalCompleted, ]; $adminEmail = str_replace('{{wp.admin_email}}', (string) get_option('admin_email', ''), $adminEmail); if(!$adminEmail) { return; } update_option('fcom_last_summary_email_send', current_time('mysql')); $emailSubject = sprintf( // translators: %d: number of days for which the summary is being reported esc_html(_n( 'Email Summary of Your Bookings (Last %d Day)', 'Email Summary of Your Bookings (Last %d Days)', $reportDays, 'fluent-booking' )), $reportDays ); $emailBody = (string)App::make('view')->make('emails.summary_report', $data); $emogrifier = new Emogrifier($emailBody); $emogrifier->disableInvisibleNodeRemoval(); $emailBbody = (string)$emogrifier->emogrify(); return Mailer::send($adminEmail, $emailSubject, $emailBbody); } }