Example #1
0
 /**
  *
  * @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 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);
 }
Example #3
0
 /**
  * @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;
 }
Example #4
0
 public function addLeadToCrm($lead)
 {
     if ($this->doesLeadExistInCrm($lead) == true) {
         return true;
     }
     //dd($lead->toArray());
     $recruit = Recruits::create($lead->toArray());
     if (!$recruit) {
         return false;
     }
     return true;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['email' => 'required|email|unique:recruits', 'first_name' => 'required', 'last_name' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $recruit = Recruits::create($request->all());
     Flash::success('Recruit has been added');
     return redirect('admin/recruiting' . '/' . $recruit->id);
 }