Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @param ReportingRepo $reporting
  * @return Response
  */
 public function dashboard(ReportingRepo $reporting)
 {
     $lead_sources = $reporting->leads_by_source();
     $leads = Lead::where('is_scrubbed', 0)->paginate(10);
     $pending_leads = PendingLead::orderBy('est_closing_date', 'ASC')->get();
     return view('admin.leadrouter.dashboard', compact('leads', 'pending_leads', 'lead_sources'));
 }
Ejemplo n.º 2
0
 public function importPendings()
 {
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         Excel::load($file, function ($reader) {
             $reader->setDateFormat('j/n/Y H:i:s');
             $results = $reader->get();
             foreach ($results as $result) {
                 $args = ['est_closing_date' => Carbon::parse($result->est_closed_date), 'office_id' => $result->office, 'lead_id' => $result->lead_id, 'tr_number' => $result->tr, 'blc_inquired' => $result->blc_inquired, 'blc_pending' => $result->blc_closed, 'address' => $result->address, 'lead_type' => $result->lead_type, 'listing_agent' => $result->lag, 'source' => $result->source, 'referral_fee' => $result->referral_fee, 'base_paid' => $result->base_paid, 'bcf' => $result->bcf, 'total_volume' => $result->total_volume, 'agent_id' => $result->agent];
                 PendingLead::updateOrCreate(['lead_id' => $result->lead_id], $args);
                 var_dump($result);
             }
         });
     }
 }
Ejemplo n.º 3
0
 public function allPendingBySource()
 {
     return PendingLead::groupBy('lead_source')->groupBy('type')->get([DB::raw('source as lead_source'), DB::raw('lead_type as type'), DB::raw('count(*) as count')]);
 }