public function rebuildLeads() { $activities = Lead::all(); foreach ($activities as $item) { $lastAct = DB::table('activities')->where('lead_id', $item->id)->where('status', 'scheduled')->orderBy('schedule_time', 'desc')->first(); if ($lastAct != null) { $item->next_action = $lastAct->schedule_time; $item->save(); } else { $item->next_action = null; $item->save(); } } }
public function xlsFile() { $leads = Lead::all(); $namefile = date('Yh:i:s') . "_leadForm"; Excel::create($namefile, function ($excel) { // Set the title $excel->setTitle('NMK Lead Form'); // Chain the setters $excel->setCreator('NMK Application')->setCompany('NMK'); // Call them separately $excel->setDescription('This files has all lead form record'); $excel->sheet('Excel sheet', function ($sheet) { $roles = Lead::all(); $sheet->setStyle(array('font' => array('name' => 'Calibri', 'size' => 13))); $sheet->row(1, array('Name', 'Gender', 'Phone', 'Company', 'Email', 'Job title', 'Interested Brands', 'Interested Products', 'Interested Demo', 'Future Seminar', 'Notes')); foreach ($roles as $key => $value) { $sheet->row(1, function ($row) { // call cell manipulation methods $row->setBackground('#888888'); $row->setFont(array('family' => 'Calibri', 'size' => '16', 'bold' => true)); }); if ($value->interested_brands == "N;") { $interested_brands = "-"; } else { $intrested_brand_array = unserialize($value->interested_brands); $interested_brands = implode(", ", $intrested_brand_array); } if ($value->future_seminars == "N;") { $future_seminars = "-"; } else { $interested_future_seminar = unserialize($value->future_seminars); $future_seminars = implode(", ", $interested_future_seminar); } $sheet->rows(array(array($value->first_name . " " . $value->last_name, $value->gender, $value->phone, $value->company_name, $value->email, $value->job_title, $interested_brands, $value->interested_product, $value->interested_demo, $future_seminars, $value->notes))); } //$sheet->fromModel($roles); // $sheet->fromArray(array( // array('Name', 'Phone','Email','Job Title','Company','Intrested Brand','Intrested Seminiar'), // $leads // )); $sheet->setOrientation('landscape'); }); })->export('xls'); }
public function testStore() { // Given $this->assertCount(0, Lead::all()); $newLeadSource = new LeadSource(['number' => '+1153614723', 'description' => 'Downtown south billboard', 'forwarding_number' => '+155005500']); $newLeadSource->save(); // When $requestParameters = ['FromCity' => 'Boston', 'FromState' => 'MS', 'From' => '+177007700', 'To' => '+1153614723', 'CallerName' => 'John Doe', 'CallSid' => '8934dj83749hd874535934']; $response = $this->call('POST', route('lead.store'), $requestParameters); // Then $this->assertEquals(201, $response->getStatusCode()); $this->assertContains('Dial', $response->getContent()); $this->assertContains('+155005500', $response->getContent()); $this->assertCount(1, Lead::all()); $lead = $newLeadSource->leads()->first(); $this->assertEquals('Boston', $lead->city); $this->assertEquals('MS', $lead->state); $this->assertEquals('+177007700', $lead->caller_number); $this->assertEquals('John Doe', $lead->caller_name); $this->assertEquals('8934dj83749hd874535934', $lead->call_sid); }
/** * @return @data list */ public function getInfolist() { $urls = Url::all(); $leads = Lead::all(); return view('app.data-list', compact('urls', 'leads')); }
public function listLeads() { $leads = Lead::all(); return view('listleads')->with('leads', $leads); }