id} AND customer_id = {$customers['id']}"); if($info instanceof \eventInfo){ return $info; } else { $info = new \eventInfo(); $info->customer_id = $customers['id']; $info->event_id = $event->id; $info->project_id = $project->id; $info->event_trigger = $event->event_trigger; $info->save(); return $info; } } /** * @param $customers * @param $project * @param $offline_data_model * @param $event * @param $event_data * @param $post * @throws \Exception */ public function sendEventDelivery($customers,$project,$offline_data_model, $event,$event_data,$post ){ if($customers){ $event_info = $this->getEventInfo($offline_data_model,$customers,$project); $templateManager = new \MyMailer\EventTemplateManager(); $data = $templateManager->insertEventData($event['name'],$project->url,$project->id, 'event_offline'); $template = $templateManager->prepareTemplate($data); $template = $templateManager->prepareEventData($event_data, $template, $post); $MyMailer = new EventMailer(); $MyMailer->setFromName($project->name); $MyMailer->SendDelivery($template->toArray(),$event,[$customers]); $event_info->last_delivery = date("Y-m-d H:i:s"); $event_info->save(); } } }