/** * 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')); }
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); } }); } }
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')]); }