public function import() { $import = new ImportHelper(storage_path() . '/c21/recruit_scrub.csv'); $recruits = $import->readElements(); foreach ($recruits as $recruit) { Recruits::updateOrCreate(['email' => $recruit->EMail], ['mls_id' => $recruit->AgentID, 'first_name' => ucwords($recruit->FirstName), 'last_name' => ucwords($recruit->LastName), 'phone_1' => $this->phone->format($recruit->Phone1), 'phone_1_type' => $recruit->Phone1Type, 'address' => $recruit->Address, 'city' => $recruit->City, 'zip_code' => $recruit->Zip, 'email' => $recruit->EMail, 'user_id' => 1, 'experience_level' => 'Experienced Agent']); } }
public function syncRecruitDataFromMls($mls_id) { $agent = $this->getAgentFromMls($mls_id); $args = ['first_name' => $agent['FirstName'], 'last_name' => $agent['LastName'], 'brokerage_code' => $agent['OfficeMLSID'], 'phone_1' => $agent['CellPhone'], 'phone_1_type' => 'Cell', 'phone_2' => $agent['HomePhone'], 'phone_2_type' => 'HomePhone']; Recruits::updateOrCreate(['mls_id' => $mls_id], $args); }