public function getRecruitProduction($id) { $recruit = Recruits::where('id', $id)->first(); $numbers = $this->reporting->recruitNumbers($recruit->mls_id); $pastNumbers = $this->reporting->recruitPastNumbers($recruit->mls_id); return view('admin.recruits.production_show', compact('recruit', 'numbers', 'pastNumbers')); }
/** * * @param ImportHelper $import * * Imports a file from csv and returns a collection * * Reformats a phone number * @param PhoneFormater $phone */ public function readElements(ImportHelper $import, PhoneFormater $phone) { $recruits = $import->readElements(); Recruits::truncate(); foreach ($recruits as $recruit) { Recruits::create(['first_name' => ucwords($recruit->FirstName), 'last_name' => ucwords($recruit->LastName), 'phone' => $phone->format($recruit->Phone1), 'address' => $recruit->Address1, 'city' => $recruit->City, 'zip_code' => $recruit->Zip, 'email' => $recruit->Email, 'status' => $recruit->ContactType, 'assigned_to' => Auth::user()->id, 'source' => $recruit->LeadSource]); } }
public function doesLeadExistInCrm($lead) { $recruit = Recruits::where('email', $lead->email)->first(); if ($recruit) { return true; } return false; }
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 getAddMiborAgentToCrm($agent_id) { $agent = $this->rets->getAgentFromMls($agent_id); $args = ['mls_id' => $agent['MLSID'], 'first_name' => $agent['FirstName'], 'last_name' => $agent['LastName'], 'address' => $agent['StreetAddress'], 'city' => $agent['StreetCity'], 'state' => 'IN', 'zip_code' => $agent['StreetPostalCode'], 'email' => $agent['Email'], 'phone_1' => $agent['CellPhone'], 'phone_1_type' => 'Cell Phone', 'phone_2' => $agent['HomePhone'], 'phone_2_type' => 'Home', 'user_id' => Auth::User()->id, 'brokerage_code' => $agent['OfficeMLSID'], 'experience_level' => 'Experienced Agent']; $recruit = Recruits::create($args); $this->rets->getRecruitListings($agent_id, $recruit->id); Flash::success('This agent has been synced and added to your database!'); return redirect('admin/recruiting' . '/' . $recruit->id); }
/** * @param $lead_id * @return static */ public function convertLeadToRecruit($lead_id) { $lead = $this->lead->find($lead_id); $args = []; foreach ($lead as $key => $value) { $args[$key] = $value; } $recruit = Recruits::create($args); return $recruit; }
public function search() { $query = Input::get('q'); $recruits = Recruits::where('last_name', 'like', '%' . $query . '%')->orWhere('first_name', 'like', '%' . $query . '%')->get(); return view('admin.search_results', compact('recruits')); }
public function syncRecruitProfileImage($recruit_id) { $recruit = Recruits::where('id', $recruit_id)->first(); if (!$recruit) { return false; } $agent = $this->getAgentFromMls($recruit->mls_id); $object = $this->rets->GetObject('Agent', 'AgentPhoto', $agent['Matrix_Unique_ID'], '1', 0); if ($object[0]['Success'] == false) { return false; } $time = time(); Storage::put('images/recruits/' . $time . '.jpg', $object[0]['Data']); $recruit->profile_img = url('img/recruits/' . $time . '.jpg'); $recruit->save(); return true; }
public function assign_lead(Request $request) { $recruit = Recruits::where('id', $request->input('recruit_id'))->first(); $recruit->user_id = $request->input('user_id'); $recruit->save(); $user = User::find($request->input('user_id')); //Fire recruit was reassigned event Mail::send('emails.recruit_reassigned', ['recruit' => $recruit], function ($message) use($user) { $message->to($user->email); $message->bcc('*****@*****.**'); $message->subject('A recruit has been assigned to you'); }); Flash::success("Recruit was successfully reassigned"); return redirect('admin/recruiting/' . $request->input('recruit_id')); }