コード例 #1
0
 /**
  * Execute the command.
  *
  * @param Lead $lead
  * @internal param Recruits $recruits
  * @internal param Recruits $recruit
  */
 public function handle(Lead $lead, MailRepo $mailRepo)
 {
     $user = User::where('email', Config::get('c21.recruiter.email'))->first();
     // dd($user->id);
     $args = ['email' => $this->request->input('email'), 'first_name' => $this->request->input('first_name'), 'last_name' => $this->request->input('last_name'), 'user_id' => $user->id, 'source' => 'C21 Career Site Business Plan', 'phone_1' => $this->request->input('phone'), 'experience_level' => $this->request->input('license_status'), 'real_estate_school' => $this->request->input('school'), 'brokerage_code' => $this->request->input('brokerage')];
     $new_lead = $lead->updateOrCreate(['email' => $this->request->input('email')], $args);
     $mailRepo->sendBusinessPlan($args, $new_lead, $user);
 }
コード例 #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255']);
     $lead = new Lead();
     $lead->name = $request->name;
     $lead->save();
     $id = $lead->id;
     return redirect('/leads/' . $id);
 }
コード例 #3
0
ファイル: HomeController.php プロジェクト: oXg3n/robertlp
 public function store(Request $request)
 {
     $this->validate($request, ['email' => 'required|email|unique:leads|max:255']);
     $lead = new Lead();
     $email = $request->input('email');
     $lead->email = $email;
     $lead->save();
     return redirect()->back()->with('message', 'Merci, nous avons bien noté votre email. Soyez patient, vous en saurez plus très prochainement !');
 }
コード例 #4
0
ファイル: LeadsRepo.php プロジェクト: jdelise/career_site
 /**
  * @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;
 }
コード例 #5
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(Lead $leadrouter)
 {
     set_time_limit(400);
     $import = new ImportHelper($this->file);
     $phone = new PhoneFormater();
     $leads = $import->readElements();
     foreach ($leads as $lead) {
         $leadrouter->updateOrCreate(['id' => $lead->id], ['id' => $lead->id, 'first_name' => ucwords($lead->first_name), 'last_name' => ucwords($lead->last_name), 'phone_1' => $phone->format($lead->phone1), 'phone_2' => $phone->format($lead->phone2), 'listing_address' => $lead->listing_address, 'listing_city' => $lead->listing_city, 'listing_zipcode' => $lead->listing_area_name, 'listing_price' => $lead->listing_price, 'email' => $lead->email, 'status' => $lead->status, 'is_scrubbed' => 0, 'agent_crest_id' => $lead->agent_legacy_id, 'source_name' => $lead->current_source, 'created_at' => Carbon::parse($lead->date_entered), 'updated_at' => Carbon::parse($lead->last_update_date_by_agent)]);
     }
     event(new LeadFileWasAdded(Auth::user()->id));
 }
コード例 #6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $ctr = 0;
     $leads = Lead::with(['note'])->where('active', 0)->where('disposition_id', 1)->orWhere('disposition_id', 0)->orderBy('updated_at')->paginate(3);
     $leads->setPath('/');
     return view('user.index', compact('leads', 'ctr'));
 }
コード例 #7
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $lead = Lead::count();
     $roadshow = Roadshow::count();
     $roadshow_registration = RoadshowRegistration::count();
     return view('admin.dashboard', compact('lead', 'roadshow', 'roadshow_registration'));
 }
コード例 #8
0
ファイル: PlayRepository.php プロジェクト: b813813/harleen
 /**
  * Mencari Lead yang dimiliki oleh Play pada wilayah kerja
  * tertentu.
  *
  * @param  int $playId Play ID
  * @param  string $workingAreaIid
  * @param  boolean $withDeleted Termasuk Lead yang sudah dihapus
  * @return \Illuminate\Support\Collection
  */
 public function findLead($playId, $workingAreaId, $withDeleted = false)
 {
     $data = Lead::where(['play_id' => $playId, 'working_area_id' => $workingAreaId]);
     if ($withDeleted) {
         $data->withTrashed();
     }
     return $data->get();
 }
コード例 #9
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $lead_id = $this->route('leads');
     $lead = Lead::findOrFail($lead_id);
     return $lead->first()->campaign()->with('users')->whereHas('users', function ($q) {
         $q->where('user_id', Auth::id())->where('role_id', config('roles.admin'));
     })->exists();
 }
コード例 #10
0
 public function delete(Request $request)
 {
     $lead = \App\Lead::find($request->get('lead_id'));
     if ($lead->delete()) {
         return json_encode(['fails' => false]);
     }
     return json_encode(['fails' => true]);
 }
コード例 #11
0
ファイル: LeadRepository.php プロジェクト: b813813/harleen
 public static function collection($workingAreaId)
 {
     $leads = Lead::with('gcf')->where('working_area_id', $workingAreaId)->orderBy('updated_at', 'created_at')->get();
     return $leads->each(function ($item, $key) {
         $play = Play::with('gcf')->find($item->play_id);
         $item->play_name = createPlayName($play->gcf->res_litho, $play->gcf->res_formation, $play->gcf->res_formation_level, $play->gcf->res_age_period, $play->gcf->res_age_epoch, $play->gcf->res_dep_env, $play->gcf->trp_type);
     });
 }
コード例 #12
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(Activity $activity)
 {
     // Edit an exisiting activity
     $statuses = Status::lists('name', 'id');
     $leads = Lead::lists('firstname', 'id');
     $types = Type::lists('name', 'id');
     $users = User::lists('name', 'id');
     return view('activities.edit', compact('activity', 'statuses', 'types', 'users', 'leads'));
 }
コード例 #13
0
ファイル: ShowRequest.php プロジェクト: henrytung/Bodie-CRM
 /**
  * Determine if the user is authorized to make this request.
  *
  * @param  Request $request
  * @return bool
  */
 public function authorize()
 {
     $lead_id = $this->route('leads');
     $lead = Lead::findOrFail($lead_id);
     if (!is_null($lead)) {
         return $lead->first()->campaign()->users->contains(Auth::id());
     }
     return false;
 }
コード例 #14
0
ファイル: EntryController.php プロジェクト: evendev/peak
 public function postEnter(Request $request)
 {
     $validator = Validator::make($request->all(), ['campaign_id' => 'required', 'first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email', 'phone' => 'required', 'street1' => 'required', 'city' => 'required', 'state' => 'required', 'zip' => 'required']);
     if ($validator->fails()) {
         session()->flash('campaign_id', $request->input('campaign_id'));
         return redirect(route('lead'))->withErrors($validator)->withInput();
     }
     $lead = Lead::create($request->all());
     event(new LeadSubmitted($lead));
     session()->flash('entry.done', true);
     return redirect(route('lead.done'));
 }
コード例 #15
0
 /**
  * Handle the event.
  *
  * @param  AttributionSubmitted  $event
  * @return Boolean
  */
 public function handle(AttributionSubmitted $event)
 {
     $lead = Lead::where('landing_page_id', $event->attribution->landing_page_id)->where('email', $event->attribution->email)->where('has_attribution', 0)->orderBy('created_at', 'DESC')->first();
     // If attribution entry is found already, set the lead id
     if (!is_null($lead)) {
         $event->attribution->lead_id = $lead->id;
         $lead->has_attribution = true;
         $event->attribution->save();
         $lead->save();
     }
     return true;
 }
コード例 #16
0
 public function adminDashboard(TaskRepo $taskRepo)
 {
     if (Auth::user()->can('can_view_dashboard')) {
         $leads = Lead::newestLeads();
         $users = User::where('can_recruit', 1)->get();
         $overdue_tasks = $taskRepo->getLateTasksBySystem();
         $appointments = $taskRepo->actionsThisMonthSystem('Appointment');
         $calls = $taskRepo->actionsThisMonthSystem('Call');
         $experienced_agents = Recruits::where('experience_level', 'Experienced Agent')->where('is_hired', 1)->whereBetween('updated_at', [Carbon::now()->startOfYear(), Carbon::now()])->count();
         $new_agents = Recruits::where('experience_level', '!=', 'Experienced Agent')->where('is_hired', 1)->whereBetween('updated_at', [Carbon::now()->startOfYear(), Carbon::now()])->count();
         return view('admin.pages.dashboard', compact('leads', 'users', 'overdue_tasks', 'calls', 'appointments', 'experienced_agents', 'new_agents'));
     }
     return redirect('admin/recruiting/dashboard');
 }
コード例 #17
0
 public function testSummaries()
 {
     // Given
     $fakeNumberOne = '+1153614723';
     $fakeNumberTwo = '+1153619723';
     $leadSourceOne = new LeadSource(['number' => '+1153614723', 'description' => 'Downtown south billboard', 'forwarding_number' => '+155005501']);
     $leadSourceTwo = new LeadSource(['number' => '+1153619723', 'description' => 'Downtown north billboard', 'forwarding_number' => '+155005502']);
     $leadSourceOne->save();
     $leadSourceTwo->save();
     $leadOne = new Lead(['caller_number' => '+148975933', 'city' => 'Some city', 'state' => 'Some state', 'caller_name' => 'John Doe', 'call_sid' => 'sup3runiq3']);
     $leadTwo = new Lead(['caller_number' => '+149824734', 'city' => 'Some other city', 'state' => 'Some state', 'caller_name' => 'John Doe', 'call_sid' => 'sup3runiq3']);
     $leadOne->leadSource()->associate($leadSourceOne->id);
     $leadOne->save();
     $leadTwo->leadSource()->associate($leadSourceTwo->id);
     $leadTwo->save();
     // When
     $responseByCity = $this->call('GET', route('lead.summary_by_city'));
     $responseByLeadSource = $this->call('GET', route('lead.summary_by_lead_source'));
     // Then
     $responseContentOne = json_decode($responseByCity->getContent(), true);
     $responseContentTwo = json_decode($responseByLeadSource->getContent(), true);
     $this->assertEquals([["lead_count" => 1, "city" => "Some other city"], ["lead_count" => 1, "city" => "Some city"]], $responseContentOne);
     $this->assertEquals([["lead_count" => 1, "description" => "Downtown south billboard", "number" => '+1153614723'], ["lead_count" => 1, "description" => "Downtown north billboard", "number" => '+1153619723']], $responseContentTwo);
 }
コード例 #18
0
ファイル: UpdateRequest.php プロジェクト: henrytung/Bodie-CRM
 /**
  * Determine if the user is authorized to make this request.
  *
  * @param  Request $request
  * @return bool
  */
 public function authorize()
 {
     $lead_id = $this->route('leads');
     $lead = Lead::findOrFail($lead_id);
     // Check if user is admin on campaign
     $is_admin_for_campaign = $lead->campaign()->with('users')->whereHas('users', function ($q) {
         $q->where('user_id', Auth::id())->where('role_id', config('roles.admin'));
     })->exists();
     // Check if user is owner of lead
     $is_owner_of_lead = $lead->users()->wherePivot('type', 'owner')->where('user_id', Auth::id())->exists();
     if ($is_admin_for_campaign || $is_owner_of_lead) {
         return true;
     }
     return false;
 }
コード例 #19
0
ファイル: TestsController.php プロジェクト: bunsha/gazingle
 public function getLeads($id, $active = false, $limit = 200)
 {
     if ($active) {
         $operator = '>';
     } else {
         $operator = '>=';
     }
     $users = $this->getUserChildren($id);
     $leadIds = [];
     $temp = \DB::table('lead_user')->select('lead_id')->whereIn('user_id', $users)->get();
     foreach ($temp as $i) {
         $leadIds[] = $i->lead_id;
     }
     $item = Lead::with('users.actions', 'users.parent', 'entity.entity_data', 'entity.contacts.addresses.phones', 'tags')->with(['activities' => function ($query) {
         $query->orderBy('created_at', 'desc');
     }])->where('active', $operator, 0)->whereIn('id', $leadIds)->orderBy('next_action', 'asc')->limit($limit)->get();
     return $item;
 }
コード例 #20
0
ファイル: LeadController.php プロジェクト: b813813/harleen
 /**
  * Menyimpan record Lead baru ke database.
  *
  * @return View
  */
 public function store(LeadFormRequest $request)
 {
     $input = $request->except(['lead.latitude_degree', 'lead.latitude_minute', 'lead.latitude_second', 'lead.latitude_cardinal', 'lead.longitude_degree', 'lead.longitude_minute', 'lead.longitude_second', 'lead.survey']);
     $lead = new Lead($input['lead']);
     $lead->working_area_id = $this->workingAreaId;
     $lead->rps_year = DB::table('sys_year')->where('is_active', '=', 1)->value('rps_year');
     if ($this->workingAreaId !== 'WK1047') {
         $lead->basin_name = DB::table('basin_working_area')->where('working_area_id', '=', $this->workingAreaId)->value('basin_name');
     }
     $gcf = new Gcf($input['gcf']);
     DB::transaction(function () use($lead, $gcf) {
         $gcf->save();
         $lead->gcf_id = $gcf->id;
         $lead->save();
     });
     session()->flash('success', 'Lead successfully created, thank you!');
     return redirect('lead');
 }
コード例 #21
0
 public function importAppointments()
 {
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         Appointment::truncate();
         Excel::load($file, function ($reader) {
             $reader->setDateFormat('j/n/Y H:i:s');
             $results = $reader->get();
             foreach ($results as $result) {
                 $args = ['user_id' => 2, 'lead_id' => $result->lead_id, 'agent_id' => NULL, 'appointment_confirmed' => $result->confirmed, 'appointment_date' => Carbon::parse($result->appointment_set_date)];
                 Appointment::create($args);
                 $lead = Lead::find($result->lead_id);
                 if ($lead) {
                     $lead->lead_acceptance_type = $result->dta;
                     $lead->save();
                 }
                 var_dump($result);
             }
         });
     }
 }
コード例 #22
0
ファイル: LeadsController.php プロジェクト: kakapa/erpbox
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Lead $lead)
 {
     // Delete lead of $id
     $lead->delete();
     flash()->success('Lead has been deleted!');
     return redirect('leads');
 }
コード例 #23
0
 public function listLeads()
 {
     $leads = Lead::all();
     return view('listleads')->with('leads', $leads);
 }
コード例 #24
0
ファイル: FakerController.php プロジェクト: bunsha/gazingle
 public function leads($num, $userId)
 {
     for ($i = 0; $i < $num; $i++) {
         $item = new Lead();
         $item->progress = $this->faker->numberBetween(5, 90);
         $item->active = $this->faker->numberBetween(0, 1);
         $item->level = $this->faker->numberBetween(0, 7);
         $item->activity_setting = $this->faker->numberBetween(1, 2);
         $item->save();
         $this->tags($this->faker->numberBetween(0, 3), $item->id);
         $user = User::find($userId);
         $user->leads()->attach($item->id);
         $entity = $this->entities();
         $item->entity_id = $entity->id;
         $item->save();
         $account = Account::find($user->account_id);
         $account->entities()->attach($entity);
         $this->activities($this->faker->numberBetween(0, 10), $item->id, $userId);
     }
 }
コード例 #25
0
 /**
  * Update the specified resource in storage.
  *
  * @param Request $request
  * @return Response
  * @internal param int $id
  */
 public function update(Request $request)
 {
     $name = $request->input('name');
     $value = $request->input('value');
     $lead = Lead::find($request->input('pk'))->first();
     $lead->{$name} = $value;
     $lead->save();
     return $lead;
 }
コード例 #26
0
 /**
  * Unwatch a lead
  * 
  * @param  ShowRequest $request
  * @param  Integer $id
  * @return String
  */
 public function getUnwatchLead(ShowRequest $request, $id)
 {
     $lead = Lead::find($id);
     if (!is_null($lead->users()->where('user_id', $this->user->id)->where('type', 'watcher')->first())) {
         $lead->users()->newPivotStatementForId($this->user->id)->where('lead_id', $id)->where('type', 'watcher')->delete();
     }
     return 'true';
 }
コード例 #27
0
ファイル: LeadsController.php プロジェクト: evendev/peak
 public function deleteDestroy($id)
 {
     $lead = Lead::destroy($id);
     return redirect(route('admin.leads.index'));
 }
コード例 #28
0
ファイル: Landing_Page.php プロジェクト: henrytung/Bodie-CRM
 /**
  * Get leads
  * 
  * @param  String $length
  * @return Collection
  */
 public function getLeads($length)
 {
     $landing_pages = [$this->id];
     $lists = collect();
     $date = $length == 'month' ? Carbon::today()->subMonth() : Carbon::today()->subWeek();
     $leads = Lead::select(array('created_at', DB::raw('COUNT(*) AS count')))->where('created_at', '>', $date)->whereIn('landing_page_id', $landing_pages)->groupBy('created_at')->orderBy('created_at', 'DESC')->get();
     if (!$leads->isEmpty()) {
         // Can't use lists() as it destroys date Carbon object
         foreach ($leads as $lead) {
             $d = $lead->created_at->timezone(Auth::user()->timezone)->toDateString();
             if ($lists->has($d)) {
                 $lists[$d] += $lead->count;
             } else {
                 $lists[$d] = $lead->count;
             }
         }
         return $lists;
     }
     return collect();
 }
コード例 #29
0
 public function getUrllinks($urlId)
 {
     $leads = Lead::where('url_id', '=', $urlId)->get();
     return view('app.ajax-link-list', compact('leads'));
 }
コード例 #30
0
 /**
  * Display the specified Lead.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $lead = Lead::with(['entity'])->findOrFail($id);
     return view('leads.show', compact('lead'));
 }