private function sendOrderEmail($id, $action) { // send email confirmation $order = Order::builder()->find($id); $laboratory = Laboratory::builder()->where('favorite_073', true)->get()->first(); // get notification account $notificationsAccount = Preference::getValue('octopusNotificationsAccount', 8); $emailAccount = EmailAccount::find($notificationsAccount->value_018); if ($emailAccount == null) { return null; } config(['mail.host' => $emailAccount->outgoing_server_013]); config(['mail.port' => $emailAccount->outgoing_port_013]); config(['mail.from' => ['address' => $emailAccount->email_013, 'name' => $emailAccount->name_013]]); config(['mail.encryption' => $emailAccount->outgoing_secure_013 == 'null' ? null : $emailAccount->outgoing_secure_013]); config(['mail.username' => $emailAccount->outgoing_user_013]); config(['mail.password' => Crypt::decrypt($emailAccount->outgoing_pass_013)]); $supervisor = User::builder()->find($order->supervisor_id_079); $shop = Shop::builder()->find($order->shop_id_079); // send email to laboratory $dataMessage = ['emailTo' => $laboratory->email_073, 'nameTo' => $laboratory->company_name_073, 'subject' => trans($action == 'update' ? 'octopus::pulsar.order_subject_update' : 'octopus::pulsar.order_subject_create', ['id' => $order->id_079, 'name' => $supervisor->name_010, 'surname' => $supervisor->surname_010]), 'order' => $order, 'supervisor' => $supervisor, 'shop' => $shop, 'key' => Crypt::encrypt($order->id_079), 'actions' => 'laboratory_order_actions_notification']; Mail::send('octopus::emails.order_notification', $dataMessage, function ($m) use($dataMessage) { $m->to($dataMessage['emailTo'], $dataMessage['nameTo'])->subject($dataMessage['subject']); }); }
public function run() { Laboratory::insert([['id_073' => 1, 'company_name_073' => 'NORTECOLOR', 'tin_073' => 'A78491966', 'country_id_073' => 'ES', 'territorial_area_1_id_073' => 'ES-MD', 'territorial_area_2_id_073' => 'ES-M', 'territorial_area_3_id_073' => null, 'cp_073' => '28037', 'locality_073' => 'Madrid', 'address_073' => 'Julián Camarillo 23', 'contact_073' => 'Hector y Paco', 'phone_073' => '91 304 21 21', 'email_073' => '*****@*****.**', 'web_073' => 'nortecolor.es', 'favorite_073' => true]]); }
public function updateCustomRecord($parameters) { Laboratory::where('id_073', $parameters['id'])->update(['company_name_073' => $this->request->input('companyName'), 'tin_073' => $this->request->has('tin') ? $this->request->input('tin') : null, 'country_id_073' => $this->request->input('country'), 'territorial_area_1_id_073' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_073' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_073' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_073' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_073' => $this->request->has('locality') ? $this->request->input('locality') : null, 'address_073' => $this->request->has('address') ? $this->request->input('address') : null, 'contact_073' => $this->request->has('contact') ? $this->request->input('contact') : null, 'phone_073' => $this->request->has('phone') ? $this->request->input('phone') : null, 'email_073' => $this->request->has('email') ? $this->request->input('email') : null, 'web_073' => $this->request->has('web') ? $this->request->input('web') : null, 'favorite_073' => $this->request->has('favorite')]); }