Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     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 = ['date_closed' => Carbon::parse($result->date_closed), 'office_id' => $result->office, 'lead_id' => $result->lead_id, 'tr_number' => $result->tr, 'blc_inquired' => $result->blc_inquired, 'blc_closed' => $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' => $result->agent];
                 Closed_Leads::create($args);
                 var_dump($result);
             }
         });
     }
 }
Пример #2
0
 public function edit($id)
 {
     $lead = Lead::find($id);
     $sources = Closed_Leads::select('lead_type')->groupBy('lead_type')->get();
     dd($lead);
 }
Пример #3
0
 public function allClosedBySource()
 {
     return Closed_Leads::whereBetween('date_closed', [$this->start, $this->end])->groupBy('lead_source')->groupBy('type')->get([DB::raw('source as lead_source'), DB::raw('lead_type as type'), DB::raw('count(*) as count')]);
 }