コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex(Campaign $campaign)
 {
     $data['user'] = $this->user;
     $data['reviews'] = $this->review;
     // キャンペーン表示用
     $user = Auth::user();
     //キャンペーン2
     $reviewCount = $user->reviews()->count();
     //STEP2
     //キャンペーンをシェアしているか
     $step2 = false;
     foreach ($user->campaigns()->get() as $camp) {
         if ($camp->camp_type == 2) {
             $step2 = true;
             break;
         }
     }
     //STEP3
     //レビューは3件以上か
     $step3 = false;
     $data['diffReview'] = 0;
     if ($reviewCount >= 3) {
         $step3 = true;
     } else {
         $data['diffReview'] = 3 - $reviewCount;
     }
     $isEntry = $step2 && $step3 ? true : false;
     $data['camp2'] = array('isEntry' => $isEntry, 'step2' => $step2, 'step3' => $step3);
     $data['count'] = $campaign->totalEntry(self::CAMP_TYPE);
     return view('mypage/index', $data);
 }
コード例 #2
0
ファイル: Campaign.php プロジェクト: VoodooPrawn/finest
 public static function addNew($data)
 {
     $campaign = new Campaign();
     $campaign->name = $data['name'];
     $campaign->sms = $data['sms'];
     $campaign->email = $data['email'];
     if ($data['scheduled_at']) {
         $campaign->scheduled_at = $data['scheduled_at'];
     }
     $campaign->email_template_id = $data['email_template_id'];
     $campaign->creator_id = Auth::user()->id;
     $campaign->save();
     return $campaign;
 }
コード例 #3
0
ファイル: PageController.php プロジェクト: jdrda/olapus
 /**
  * Get homepage
  *
  * @param Request $request
  * @return View|void
  */
 public function getHomepage(Request $request)
 {
     /**
      * Load data
      */
     $this->_arViewData = $this->_loadPageByUrl('/');
     /**
      * Number of users
      */
     $this->_arViewData['users_no'] = User::count() + 135000;
     /**
      * Number of campaigns
      */
     $this->_arViewData['campaigns_no'] = Campaign::count();
     /**
      * Number of payments total
      */
     $this->_arViewData['payments_no_total'] = Payment::sum('amount');
     /**
      * Number of payments last month
      */
     $this->_arViewData['payments_no_last_month'] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count();
     /**
      * Return view
      */
     return $this->_showViewOr404('frontend.homepage');
 }
コード例 #4
0
 /**
  * Make sure getCampaignNumbers method works as expected.
  */
 public function test_get_campaign_numbers()
 {
     $user = factory(\App\User::class)->create();
     $year = 2016;
     $expected = ['success' => true, 'numbers' => \App\Campaign::select('number')->distinct()->where('year', $year)->get()];
     $this->actingAs($user)->post('/statistics/campaign/get-numbers', ['year' => $year])->seeJson($expected);
 }
コード例 #5
0
ファイル: IndexController.php プロジェクト: bitller/nova
 /**
  * Handle creation of new bill.
  *
  * @param CreateBillRequest $request
  * @return array
  */
 public function create(CreateBillRequest $request)
 {
     // Save request data
     $clientName = $request->get('client');
     $useCurrentCampaign = $request->get('use_current_campaign');
     $campaignYear = $request->get('campaign_year');
     $campaignNumber = $request->get('campaign_number');
     $client = DB::table('clients')->where('name', $clientName)->where('user_id', Auth::user()->id)->first();
     // Create new client if not exists
     if (!$client) {
         $client = new Client();
         $client->user_id = Auth::user()->id;
         $client->name = $clientName;
         $client->save();
     }
     // Create new bill
     $bill = new Bill();
     $bill->client_id = $client->id;
     $bill->user_id = Auth::user()->id;
     $campaign = Campaigns::current();
     // Check if current campaign should be used
     if (!$useCurrentCampaign) {
         $campaign = Campaign::where('year', $campaignYear)->where('number', $campaignNumber)->first();
     }
     $bill->campaign_id = $campaign->id;
     $bill->campaign_order = Campaigns::autoDetermineOrderNumber($campaign, $client->id);
     $bill->save();
     event(new UserCreatedNewBill(Auth::user()->id, $bill->id));
     // Return response
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('bills.bill_created'));
     return response($response->get());
 }
コード例 #6
0
ファイル: CampaignTableSeeder.php プロジェクト: bitller/nova
 public function run()
 {
     // Campaigns for 2016
     $campaigns = [['year' => 2016, 'start_date' => '2015-12-28', 'end_date' => '2016-01-20', 'number' => 1], ['year' => 2016, 'start_date' => '2016-01-21', 'end_date' => '2016-02-10', 'number' => 2], ['year' => 2016, 'start_date' => '2016-02-11', 'end_date' => '2016-03-02', 'number' => 3], ['year' => 2016, 'start_date' => '2016-03-03', 'end_date' => '2016-03-23', 'number' => 4], ['year' => 2016, 'start_date' => '2016-03-24', 'end_date' => '2016-04-13', 'number' => 5], ['year' => 2016, 'start_date' => '2016-04-14', 'end_date' => '2016-05-04', 'number' => 6], ['year' => 2016, 'start_date' => '2016-05-05', 'end_date' => '2016-05-25', 'number' => 7], ['year' => 2016, 'start_date' => '2016-05-26', 'end_date' => '2016-06-15', 'number' => 8], ['year' => 2016, 'start_date' => '2016-06-16', 'end_date' => '2016-07-06', 'number' => 9], ['year' => 2016, 'start_date' => '2016-07-07', 'end_date' => '2016-07-27', 'number' => 10], ['year' => 2016, 'start_date' => '2016-07-28', 'end_date' => '2016-08-17', 'number' => 11], ['year' => 2016, 'start_date' => '2016-08-18', 'end_date' => '2016-09-07', 'number' => 12], ['year' => 2016, 'start_date' => '2016-09-08', 'end_date' => '2016-09-28', 'number' => 13], ['year' => 2016, 'start_date' => '2016-09-29', 'end_date' => '2016-10-19', 'number' => 14], ['year' => 2016, 'start_date' => '2016-10-20', 'end_date' => '2016-11-09', 'number' => 15], ['year' => 2016, 'start_date' => '2016-11-10', 'end_date' => '2016-11-30', 'number' => 16], ['year' => 2016, 'start_date' => '2016-12-01', 'end_date' => '2016-12-28', 'number' => 17]];
     foreach ($campaigns as $campaign) {
         \App\Campaign::create($campaign);
     }
 }
コード例 #7
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     if (!$request->input('campaign')) {
         return redirect()->back();
     }
     $campaign = Campaign::find($request->input('campaign'));
     return view()->make('touches.create')->with(['campaign' => $campaign, 'client' => $campaign->client]);
 }
コード例 #8
0
 public function run()
 {
     $contacts = Contact::all();
     $campaign = Campaign::where('name', '=', 'Halloween Video')->first();
     foreach ($contacts as $contact) {
         Email::create(['send_on' => Carbon::now()->addMinutes(5), 'template' => 'emails.halloween', 'subject' => 'Happy Halloween!', 'draft' => false, 'campaign_id' => $campaign->id, 'contact_id' => $contact->id]);
     }
 }
コード例 #9
0
ファイル: EntryController.php プロジェクト: evendev/peak
 public function getEnter(Request $request)
 {
     if (!session()->has('campaign_id')) {
         return redirect(route('pin'));
     }
     $campaign = Campaign::findOrFail(session()->get('campaign_id'));
     return view('entry.lead', compact('campaign'));
 }
コード例 #10
0
ファイル: CharacterTest.php プロジェクト: shairozan/oSPITE
 public function testDeleteCharacter()
 {
     $user = User::find(1);
     $campaign = Campaign::find(1);
     $character_id = Character::where('name', 'Bilbo Baggins')->max('id');
     $this->actingAs($user)->withSession(['campaign' => $campaign])->visit('/characters/' . $character_id . '/delete');
     $this->visit('/test/characters')->dontSee('Bilbo Baggins');
 }
コード例 #11
0
ファイル: Campaigns.php プロジェクト: bitller/nova
 /**
  * Get current campaign
  *
  * @return bool|object
  */
 public static function current()
 {
     $date = date('Y-m-d');
     $currentCampaign = Campaign::where('start_date', '<=', $date)->where('end_date', '>=', $date)->first();
     if (!$currentCampaign) {
         return false;
     }
     return $currentCampaign;
 }
コード例 #12
0
ファイル: StoreRequest.php プロジェクト: henrytung/Bodie-CRM
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     // URL route is implicitly defined as the resource
     $landing_page_id = $this->route('landing_pages');
     $campaign_id = Landing_Page::findOrFail($landing_page_id)->first()->campaign->id;
     return Campaign::where('id', $campaign_id)->with('users')->whereHas('users', function ($q) {
         $q->where('user_id', Auth::id())->where('role_id', config('roles.admin'));
     })->exists();
 }
コード例 #13
0
ファイル: ShowRequest.php プロジェクト: henrytung/Bodie-CRM
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     // URL route is implicitly defined as the resource
     $campaign_id = $this->route('campaigns');
     $campaign = Campaign::findOrFail($campaign_id);
     return $campaign->with('users')->whereHas('users', function ($q) {
         $q->where('user_id', Auth::id());
     })->exists();
 }
コード例 #14
0
 /**
  * Called before each test.
  */
 public function setUp()
 {
     parent::setUp();
     // Generate user and client
     $this->user = factory(App\User::class)->create();
     $this->client = factory(\App\Client::class)->create(['user_id' => $this->user->id]);
     // Generate the two bills
     $this->billInFirstCampaign = factory(\App\Bill::class)->create(['user_id' => $this->user->id, 'client_id' => $this->client->id, 'campaign_id' => \App\Campaign::where('year', $this->firstCampaign['year'])->where('number', $this->firstCampaign['number'])->first()->id]);
     $this->billInComparedCampaign = factory(\App\Bill::class)->create(['user_id' => $this->user->id, 'client_id' => $this->client->id, 'campaign_id' => \App\Campaign::where('year', $this->secondCampaign['year'])->where('number', $this->secondCampaign['number'])->first()->id]);
     $this->baseExpected = ['sold_products_label' => trans('statistics.sold_products_label', ['campaign_number' => $this->firstCampaign['number'], 'campaign_year' => $this->firstCampaign['year']]), 'sold_products_in_campaign_to_compare_label' => trans('statistics.sold_products_label', ['campaign_number' => $this->secondCampaign['number'], 'campaign_year' => $this->secondCampaign['year']])];
 }
コード例 #15
0
 /**
  * Called before each test.
  */
 public function setUp()
 {
     parent::setUp();
     // Generate user and client
     $this->user = factory(\App\User::class)->create();
     $this->client = factory(\App\Client::class)->create(['user_id' => $this->user->id]);
     // Create bill in first campaign
     $this->billInFirstCampaign = factory(\App\Bill::class)->create(['user_id' => $this->user->id, 'client_id' => $this->client->id, 'campaign_id' => \App\Campaign::where('number', $this->firstCampaign['number'])->where('year', $this->firstCampaign['year'])->first()->id]);
     // Create bill in campaign to compare
     $this->billInCampaignToCompare = factory(\App\Bill::class)->create(['user_id' => $this->user->id, 'client_id' => $this->client->id, 'campaign_id' => \App\Campaign::where('number', $this->secondCampaign['number'])->where('year', $this->secondCampaign['year'])->first()->id]);
     $this->translationData = ['campaign_number' => $this->firstCampaign['number'], 'campaign_year' => $this->firstCampaign['year'], 'other_campaign_number' => $this->secondCampaign['number'], 'other_campaign_year' => $this->secondCampaign['year']];
     $this->baseExpected = ['discount_offered_label' => trans('statistics.offered_discount_label', ['campaign_number' => $this->firstCampaign['number'], 'campaign_year' => $this->firstCampaign['year']]), 'discount_offered_in_campaign_to_compare_label' => trans('statistics.offered_discount_label', ['campaign_number' => $this->secondCampaign['number'], 'campaign_year' => $this->secondCampaign['year']])];
 }
コード例 #16
0
ファイル: Kernel.php プロジェクト: VoodooPrawn/finest
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->call(function () {
         ShippingIntegrationController::checkTrackingNumbers();
     })->everyMinute();
     $schedule->call(function () {
         Log::info('In cron job');
         $now = Carbon::now();
         if (Campaign::where('status', 0)->where('scheduled_at', '<', $now)->count() > 0) {
             $campaigns = Campaign::where('status', 0)->where('scheduled_at', '<', $now)->get();
             foreach ($campaigns as $campaign) {
                 $campaign->doSendAll();
             }
         }
     })->everyMinute();
 }
コード例 #17
0
 public function report($id)
 {
     $campaign = Campaign::find($id);
     $summary = [];
     $actions = Action::with('contact')->forCampaign($campaign)->orderBy('contact_id')->get();
     $summary['total_sent'] = $campaign->emails->count();
     $summary['opened'] = $actions->filter(function ($action) {
         return $action->action === 'opened';
     })->count();
     $summary['more info'] = $actions->filter(function ($action) {
         return $action->action === 'more info';
     })->count();
     $summary['website_visits'] = $actions->filter(function ($action) {
         return $action->action === 'website';
     })->count();
     $summary['skipped_video'] = $actions->filter(function ($action) {
         return $action->action === 'skipped';
     })->count();
     $summary['emailed_bill'] = $actions->filter(function ($action) {
         return $action->action === 'email';
     })->count();
     $summary['youtube_channel'] = $actions->filter(function ($action) {
         return $action->action === 'youtube';
     })->count();
     $summary['unsubscribed'] = Contact::where('unsubscribe', '=', 1)->count();
     \Excel::create('Report', function ($excel) use($actions, $summary, $campaign) {
         $excel->setTitle("eMail Report for {$campaign->name}")->setCreator('Exhibit Partners Mailer Service')->setCompany('Exhibit Partners')->setDescription("A detailed report of email recipients for the {$campaign->name} email campaign");
         $excel->sheet('Summary', function ($sheet) use($summary) {
             $sheet->row(1, ['Total', 'Opened', 'Went To Page 2', 'Website Visits', 'Skipped The Video', 'Emailed Bill', 'YouTube Channel', 'Unsubscribed']);
             $sheet->row(2, [$summary['total_sent'], $summary['opened'], $summary['more info'], $summary['website_visits'], $summary['skipped_video'], $summary['emailed_bill'], $summary['youtube_channel'], $summary['unsubscribed']]);
         });
         $excel->sheet('Recipient Actions', function ($sheet) use($actions) {
             $sheet->row(1, ['Contact', 'Email', 'Action']);
             foreach ($actions as $key => $action) {
                 $sheet->row($key + 2, [$action->contact->name, $action->contact->email, $action->action]);
             }
         });
     })->download('xlsx');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('touches', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('campaign_id')->unsigned();
         $table->string('template');
         $table->string('title_slug');
         $table->string('subject');
         $table->dateTime('send_on');
         $table->timestamps();
     });
     $cwtBC = Campaign::where('title_slug', '=', 'engage_boston_c')->first();
     $cwtBP = Campaign::where('title_slug', '=', 'engage_boston_p')->first();
     $cwtNC = Campaign::where('title_slug', '=', 'engage_new_york_c')->first();
     $cwtNP = Campaign::where('title_slug', '=', 'engage_new_york_p')->first();
     $cwtBIC = Campaign::where('title_slug', '=', 'engage_boston_invite_c')->first();
     $cwtBIP = Campaign::where('title_slug', '=', 'engage_boston_invite_p')->first();
     $cwtNIC = Campaign::where('title_slug', '=', 'engage_new_york_invite_c')->first();
     $cwtNIP = Campaign::where('title_slug', '=', 'engage_new_york_invite_p')->first();
     $h = Campaign::where('title_slug', '=', 'halloween')->first();
     $vC = Campaign::where('title_slug', '=', 'vitality_holiday_client')->first();
     $vB = Campaign::where('title_slug', '=', 'vitality_holiday_broker')->first();
     if ($cwtBC) {
         $this->migrateTouches($cwtBC, $cwtBC);
     }
     if ($cwtBP) {
         $this->migrateTouches($cwtBP, $cwtBP);
     }
     if ($cwtNC) {
         $this->migrateTouches($cwtNC, $cwtNC);
     }
     if ($cwtNP) {
         $this->migrateTouches($cwtNP, $cwtNP);
     }
     if ($cwtBIC && $cwtBC) {
         $this->migrateTouches($cwtBIC, $cwtBC);
     }
     if ($cwtBIP && $cwtBP) {
         $this->migrateTouches($cwtBIP, $cwtBP);
     }
     if ($cwtNIC && $cwtNC) {
         $this->migrateTouches($cwtNIC, $cwtNC);
     }
     if ($cwtNIP && $cwtNP) {
         $this->migrateTouches($cwtNIP, $cwtNP);
     }
     if ($h) {
         $this->migrateTouches($h, $h);
     }
     if ($vC) {
         $this->migrateTouches($vC, $vC);
     }
     if ($vB) {
         $this->migrateTouches($vB, $vB);
     }
     $cwtBIC->delete();
     $cwtBIP->delete();
     $cwtNIC->delete();
     $cwtNIP->delete();
     $this->addContactsToCampaign($cwtBC);
     $this->addContactsToCampaign($cwtBP);
     $this->addContactsToCampaign($cwtNC);
     $this->addContactsToCampaign($cwtNP);
     $this->addContactsToCampaign($vC);
     $this->addContactsToCampaign($vB);
     $this->addContactsToCampaign($h);
 }
コード例 #19
0
ファイル: CreateBillTest.php プロジェクト: bitller/nova
 /**
  * User create new bill with client name used by another user and does not use current campaign.
  */
 public function test_create_bill_with_client_name_used_by_another_user_using_other_campaign()
 {
     $secondUser = factory(\App\User::class)->create();
     $clientOfSecondUser = factory(\App\Client::class)->create(['user_id' => $secondUser->id]);
     $this->postData['client'] = $clientOfSecondUser->name;
     unset($this->postData['use_current_campaign']);
     $this->postData['campaign_year'] = date('Y');
     $this->postData['campaign_number'] = rand(1, 17);
     $this->actingAs($this->user)->post('/bills/create', $this->postData)->seeJson(['success' => true, 'message' => trans('bills.bill_created')])->seeInDatabase('bills', ['user_id' => $this->user->id, 'client_id' => \App\Client::where('user_id', $this->user->id)->where('name', $this->postData['client'])->first()->id, 'campaign_id' => \App\Campaign::where('year', $this->postData['campaign_year'])->where('number', $this->postData['campaign_number'])->first()->id, 'campaign_order' => 1]);
 }
コード例 #20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $campaigns = Campaigns::findOrFail($id);
     $campaigns->delete();
     //Session::flash('flash_message', 'Campaign successfully deleted!');
     return redirect('campaigns');
 }
コード例 #21
0
ファイル: StatisticsController.php プロジェクト: bitller/nova
 /**
  * Return all campaign numbers for given year.
  *
  * @param Requests\Statistics\GetCampaignNumbersRequest $request
  * @return mixed
  */
 public function getCampaignNumbers(GetCampaignNumbersRequest $request)
 {
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('common.success'));
     $response->addExtraFields(['numbers' => Campaign::select('number')->distinct()->where('year', $request->get('year'))->get()]);
     return response($response->get())->header('Content-Type', 'application/json');
 }
コード例 #22
0
 /**
  * Unarchive the campaign
  * 
  * @param  AdminShowRequest $request
  * @param  Integer $id
  * @return Redirect
  */
 public function putUnarchiveCampaign(AdminShowRequest $request, $id)
 {
     $campaign = Campaign::findOrFail($id);
     if (strtolower($request->get('title')) == strtolower($campaign->title)) {
         $campaign->active = 1;
         $campaign->save();
         return redirect('campaigns/' . $campaign->id)->with('status', \Lang::get('campaign.unarchive.successful', ['title' => $campaign->title]));
     } else {
         return redirect('campaigns/' . $campaign->id . '/unarchive')->with('status', \Lang::get('campaign.unarchive.unsuccessful', ['title' => $campaign->title]));
     }
 }
コード例 #23
0
ファイル: CampaignSeeder.php プロジェクト: shairozan/oSPITE
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\Campaign::create(['name' => 'Dawning of the End', 'active' => 1, 'summary' => 'Teh awesomeness']);
 }
コード例 #24
0
 public function campaignSwitch(Request $request)
 {
     $campaign = Campaign::find($request->get('campaign_id'));
     \Session::set('campaign', $campaign);
     //Check if we're an admin in the campaign
     $membership = CampaignMembership::where('user_id', \Auth::user()->id)->where('campaign_id', $campaign->id)->first();
     if ($membership->is_dm == 1) {
         \Session::set('dm', 1);
     } else {
         \Session::set('dm', 0);
     }
     return redirect(\URL::to('/'));
 }
コード例 #25
0
 /**
  * Make sure detailsAboutNumberOfClients works as expected when both campaigns have same number of clients.
  */
 public function test_details_about_number_of_clients_when_both_campaigns_have_same_number_of_clients()
 {
     $clients = factory(\App\Client::class, 4)->create(['user_id' => $this->user->id]);
     foreach ($clients as $client) {
         factory(\App\Bill::class)->create(['client_id' => $client->id, 'user_id' => $this->user->id, 'campaign_id' => \App\Campaign::where('number', $this->firstCampaign['number'])->where('year', $this->firstCampaign['year'])->first()->id]);
         factory(\App\Bill::class)->create(['client_id' => $client->id, 'user_id' => $this->user->id, 'campaign_id' => \App\Campaign::where('number', $this->secondCampaign['number'])->where('year', $this->secondCampaign['year'])->first()->id]);
     }
     $this->translationData['clients'] = 4;
     $expected = ['message' => trans('statistics.details_about_number_of_clients_equal_trend', $this->translationData), 'title' => trans('statistics.details_about_number_of_clients_equal_trend_title'), 'number_of_clients' => 4, 'number_of_clients_in_campaign_to_compare' => 4];
     $expected = array_merge($expected, $this->baseExpected);
     $this->actingAs($this->user)->assertEquals($expected, \App\Helpers\Statistics\CompareCampaignsStatistics::detailsAboutNumberOfClients($this->firstCampaign, $this->secondCampaign));
 }
コード例 #26
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $campaign = Campaign::findOrFail($id);
     $campaign->delete();
     return redirect('campaign');
 }
コード例 #27
0
 public function remove_domain($id, $domain_id, $sort = 'domain', $dir = 'ASC')
 {
     $campaign = Campaign::find($id);
     if ($campaign == null || $campaign->status == Campaign::STATUS_CREATED || $campaign->status == Campaign::STATUS_IN_PROGRESS) {
         return redirect('campaigns')->with('notice', ['title' => 'Error!', 'text' => 'Campaign not found.']);
     }
     $domain = CampaignDomain::find($domain_id);
     if ($domain == null) {
         return redirect('campaigns/' . $id . '/' . $sort . '/' . $dir)->with('notice', ['title' => 'Error!', 'text' => 'Domain not found.']);
     }
     $domain->delete();
     return redirect('campaigns/' . $id . '/' . $sort . '/' . $dir)->with('notice', ['title' => 'Domain removed', 'text' => 'You have removed domain.']);
 }
コード例 #28
0
 public function contactList($id)
 {
     $campaign = Campaign::find($id);
     $contacts = array_map(function ($contact) {
         unset($contact['pivot'], $contact['id'], $contact['client_id'], $contact['updated_at'], $contact['created_at']);
         return $contact;
     }, $campaign->contacts->toArray());
     $metrics = Excel::create("{$campaign->name} Contacts", function ($excel) use($campaign, $contacts) {
         $today = Carbon::now()->format('M jS');
         $excel->setTitle("Event Contacts as of {$today} for {$campaign->name}");
         $excel->setCreator("EP-Productions");
         $excel->setCompany('Exhibit Partners');
         $excel->setDescription("Event Contacts from an email campaign for {$campaign->client}->name");
         $excel->sheet('Contacts', function ($sheet) use($contacts) {
             $sheet->fromArray($contacts);
         });
     })->download('xlsx');
     return $metrics;
 }
コード例 #29
0
 public function doDeleteCampaign($id)
 {
     $campaign = Campaign::findOrFail($id);
     $campaign->remove();
     return redirect()->back()->with('campaign-deleted', true);
 }
コード例 #30
0
 public function addSelectedContacts($id, Request $request)
 {
     $contacts = $request->contacts;
     if (!$contacts) {
         return redirect()->back()->with('error', "So... you uh, didnt select any contacts.");
     }
     $campaign = Campaign::find($id)->contacts()->attach($contacts);
     $count = count($contacts);
     return redirect()->route('admin.campaigns.show', $id)->with('message', "added {$count} contacts to the campaign.");
 }