當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Contact::on方法代碼示例

本文整理匯總了PHP中app\Contact::on方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contact::on方法的具體用法?PHP Contact::on怎麽用?PHP Contact::on使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Contact的用法示例。


在下文中一共展示了Contact::on方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: newMultiUnit

 public function newMultiUnit($updatesA, $unit, $database)
 {
     $echo = "Entering newMultiUnit ........................................ ";
     File::append($this->logfilename, $echo . "\r\n");
     //dd($updatesA, $unit);
     // check if multiple units
     // get sqM for specific unit
     $a = explode(" & ", $updatesA['strComplexNo']);
     $sqM = explode(" & ", $updatesA['strSqMeters']);
     $found = in_array($unit, $a);
     if ($found) {
         $place = array_search($unit, $a);
         $updatesA['strSqMeters'] = $sqM[$place];
     }
     $now = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString();
     $updatesA['id'] = null;
     $updatesA['strKey'] = $updatesA['strKey'];
     $updatesA['numStreetNo'] = $updatesA['strStreetNo'];
     $updatesA['numComplexNo'] = $updatesA['strComplexNo'];
     $updatesA['created_at'] = $now;
     // dd($updatesA, $a, $found, $place, $a[$place], $sqM[$place]);
     // delete older ones
     $delOld = Property::on($database)->where('strKey', $updatesA['strKey'])->where(DB::raw("STR_TO_DATE(dtmRegDate, '%Y-%m-%d')"), '<', Date($updatesA['dtmRegDate']))->delete();
     $echo = "..DELETE OLD ............    " . $updatesA['strKey'] . "   -   " . $delOld;
     File::append($this->logfilename, $echo . "\r\n");
     // insert new property record
     Property::on($database)->insert($updatesA);
     // add owner record if not existing
     //
     $hascontact = Owner::on($database)->select('id')->where('strIDNumber', '=', $updatesA['strIdentity']);
     if ($hascontact->count() == 0) {
         // update details from admin contacts
         $admin_contacts = "farmbook_admin";
         $otf = new \App\Database\OTF(['database' => $admin_contacts]);
         $db = DB::connection($admin_contacts);
         $owner_details = Contact::on($admin_contacts)->select('*')->where('strIDNumber', $updatesA['strIdentity'])->first();
         // contact details found in admin contacts
         if (sizeof($owner_details) == 1) {
             $uid = $owner_details->strIDNumber;
             // set database back
             $dbname = $database;
             $otf = new \App\Database\OTF(['database' => $dbname]);
             $db = DB::connection($dbname);
             // update contact details
             $owner = Owner::on($database)->insert(array('strIDNumber' => $owner_details->strIDNumber, 'NAME' => $owner_details->NAME, 'TITLE' => $owner_details->TITLE, 'INITIALS' => $owner_details->INITIALS, 'strSurname' => $owner_details->strSurname, 'strFirstName' => $owner_details->strFirstName, 'strHomePhoneNo' => $owner_details->strHomePhoneNo, 'strWorkPhoneNo' => $owner_details->strWorkPhoneNo, 'strCellPhoneNo' => $owner_details->strCellPhoneNo, 'EMAIL' => $owner_details->EMAIL, 'created_at' => $now, 'updated_at' => $now));
             // update from prop rec
         } else {
             $dbname = $database;
             $otf = new \App\Database\OTF(['database' => $dbname]);
             $db = DB::connection($dbname);
             $owner = Owner::on($database)->insert(array('strIDNumber' => $updatesA['strIdentity'], 'NAME' => $updatesA['strOwners'], 'created_at' => $now));
         }
     } else {
         // dont wipe old details
     }
     // add note
     //
     $hasnote = Note::on($database)->select('id')->where('strKey', '=', $updatesA['strKey'])->get();
     if ($hasnote->count() == 0) {
         //$note       = Note::on($database)->insert(array('strKey' => $updatesA[$x]['strKey'], 'numErf' => $updatesA[$x]['numErf'], 'memNotes' => "\n" . $now . '  ' . $updatesA[$x]['strOwners'] . '  - New Owner.', 'created_at' => $now));
         $note = Note::on($database)->insert(array('strKey' => $updatesA['strKey'], 'numErf' => $updatesA['numErf'], 'created_at' => $now));
     } else {
         $note = Note::on($database)->where('strKey', '=', $updatesA['strKey'])->update(array('memNotes' => DB::raw('concat(memNotes, " \\n' . $now . '  ' . $updatesA['strOwners'] . ' -  New Owner.")'), 'updated_at' => $now));
     }
     $echo = "Finishing newMultiUnit ........................................  ";
     File::append($this->logfilename, $echo . "\r\n");
 }
開發者ID:bikedel,項目名稱:farmbook_admin,代碼行數:67,代碼來源:UpdateController.php


注:本文中的app\Contact::on方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。