コード例 #1
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');
 }
コード例 #2
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]);
 }
コード例 #3
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');
 }
コード例 #4
0
 /**
  * Show the form for adding landing page
  * 
  * @param  AdminShowRequest $request
  * @param  Integer $id
  * @return Response
  */
 public function getAddLandingPage(AdminShowRequest $request, $id)
 {
     $campaign = Campaign::find($id);
     return view('campaigns.add_landing_page')->with('user', $this->user)->with('campaign', $campaign);
 }
コード例 #5
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('/'));
 }
コード例 #6
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.");
 }
コード例 #7
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;
 }
コード例 #8
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.']);
 }
コード例 #9
0
ファイル: routes.php プロジェクト: sethphillips/event_mailer
        $request->session()->put('salted_id', $salted_id);
    } else {
        $salted_id = $request->session()->get('salted_id', null);
    }
    return view('emails.halloween')->with(['salted_id' => $salted_id, 'email' => false]);
}]);
Route::get('tracking', ['as' => 'tracking', function (Request $request) {
    if ($request->input('email')) {
        $salted_id = $request->input('email');
        $email = Email::where('salted_id', '=', $salted_id)->first();
        if ($email && $email->trackable) {
            $action = Action::firstOrCreate(['action' => 'opened', 'contact_id' => $email->contact->id, 'campaign_id' => $email->campaign->id, 'touch_id' => $email->touch_id]);
        }
    }
    return \Image::canvas(10, 10)->encode('gif');
}]);
Route::get('emails/{title_slug}', ['as' => 'emails', 'uses' => 'EmailController@renderEmail']);
Route::get('ep_vikings_signup', ['as' => 'ep_vikings_signup', 'uses' => 'SignupController@epVikingsSignup']);
Route::post('ep_vikings_signup', ['as' => 'ep_vikings_submit', 'uses' => 'SignupController@epVikingsSubmit']);
Route::get('engage_signup', ['as' => 'engage_signup_generic', 'uses' => 'SignupController@engageGeneric']);
Route::post('engage_signup', ['as' => 'engage_signup_redirect', 'uses' => 'SignupController@engageRedirect']);
Route::get('engage_signup/{name}', ['as' => 'engage_signup', 'uses' => 'SignupController@engage']);
Route::post('signup', ['as' => 'signup', 'uses' => 'SignupController@signup']);
Route::post('signup/forward', ['as' => 'signup.forward', 'uses' => 'SignupController@signupForward']);
Route::get('testmail', function () {
    $campaign = Campaign::find(2);
    \Mail::send('emails.cwt.engage', ['email' => true, 'campaign' => $campaign, 'salted_id' => 'foo'], function ($mail) {
        $mail->to('*****@*****.**', 'Seth Phillips')->subject('test email');
    });
    return 'tested';
});
コード例 #10
0
 public function signupForward(Request $request)
 {
     $email = $request->input('email');
     if (!$this->checkEmail($email)) {
         return redirect()->back()->withInput()->with('error', "{$email} is not a valid email");
     }
     $campaign = Campaign::find($request->input('campaign_id'));
     $touch = $campaign->touchs()->first();
     $date = \Carbon\Carbon::now()->toDateTimeString();
     $contact = Contact::firstOrCreate(['email' => $email, 'client_id' => $touch->campaign->client->id]);
     if ($contact->unsubscribe || $contact->bounced) {
         return redirect()->back()->with('message', "{$contact->email} is unreachable or has unsubscribed");
     }
     $newEmail = Email::create(['subject' => $touch->subject, 'reply_to' => $touch->campaign->client->reply_to, 'from' => $touch->campaign->client->reply_to, 'send_on' => $date, 'template' => "emails.{$touch->template}", 'draft' => false, 'trackable' => false, 'campaign_id' => $touch->campaign->id, 'contact_id' => $contact->id, 'touch_id' => $touch->id]);
     $newEmail->salted_id = bcrypt($newEmail->id);
     $newEmail->save();
     return redirect()->back()->with('message', "We will contact {$email} right away");
 }