当前位置: 首页>>代码示例>>PHP>>正文


PHP Tracker::save方法代码示例

本文整理汇总了PHP中Tracker::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker::save方法的具体用法?PHP Tracker::save怎么用?PHP Tracker::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracker的用法示例。


在下文中一共展示了Tracker::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_email

 public function send_email($dummy)
 {
     $rules = array('from_name' => 'required|max:128', 'from_email' => 'required|email|max:255', 'subject' => 'required|max:128', 'emailbody' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json(array('validation' => $validator->messages()->toArray()));
     } else {
         $from_name = Input::get('from_name');
         $from_email = Input::get('from_email');
         $selected = Input::get('to');
         $subject = Input::get('subject');
         $emailbody = Input::get('emailbody');
         $from = $from_name . ' (' . $from_email . ')';
         $recipients = Subscriber::whereIn('email', $selected)->where('active', '=', 1)->get();
         $email = new Email();
         $email->from = $from;
         $email->subject = $subject;
         $email->message = $emailbody;
         $email->save();
         $email_id = $email->id;
         $numrecipients = $recipients->count();
         $numsent = 0;
         foreach ($recipients as $key => $recipient) {
             $tracker = new Tracker();
             $tracker->subscriber_id = $recipient->id;
             $tracker->email_id = $email_id;
             $tracker->save();
             $tracker_id = $tracker->id;
             $tracker_url = URL::to('tracker/' . $tracker_id);
             $unsubscriber_url = URL::to('unsubscribe/' . $tracker_id);
             $subscriber = $recipient;
             $data = array('emailbody' => $emailbody, 'tracker' => $tracker_url, 'unsubscribe' => $unsubscriber_url, 'subscriber' => $subscriber);
             $to_email = $subscriber->email;
             $to_name = $subscriber->first_name . ' ' . $subscriber->last_name;
             $issent = Mail::send('emails.sub-emails', $data, function ($message) use($from_email, $from_name, $to_email, $to_name, $subject) {
                 $message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
             });
             if ($issent) {
                 $numsent += 1;
             } else {
                 $tracker->bounced = 1;
                 $tracker->save();
             }
         }
         if ($numsent == $numrecipients) {
             return Response::json(array('success' => 'Your email was successfully sent to <b>' . $numsent . '</b> subscribers out of the ' . $numrecipients . ' subscribers you selected. <b>Rejoice!</b>'));
         } else {
             return Response::json(array('success' => 'Your email was successfully sent to <b>' . $numsent . '</b> subscribers out of the ' . $numrecipients . 'All bounces have been logged.'));
         }
     }
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:51,代码来源:EmailController.php

示例2: save

 public function save()
 {
     $result = parent::save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_piwik');
     $db->addWhere('id', $this->id);
     $result = $db->select();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_piwik');
     $db->addValue('id', $this->id);
     $db->addValue('piwik_url', $this->piwik_url);
     $db->addValue('piwik_id', $this->piwik_id);
     if (count($result) < 1) {
         $result = $db->insert(false);
     } else {
         $result = $db->update();
     }
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:25,代码来源:PiwikTracker.php

示例3: save

 public function save()
 {
     $result = parent::save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_owa');
     $db->addWhere('id', $this->id);
     $result = $db->select();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_owa');
     $db->addValue('id', $this->id);
     $db->addValue('owa_url', $this->owa_url);
     $db->addValue('owa_site_id', $this->owa_site_id);
     $db->addValue('owa_track_page_view', $this->owa_track_page_view);
     $db->addValue('owa_track_clicks', $this->owa_track_clicks);
     $db->addValue('owa_track_domstream', $this->owa_track_domstream);
     if (count($result) < 1) {
         $result = $db->insert(false);
     } else {
         $result = $db->update();
     }
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:28,代码来源:OpenWebAnalyticsTracker.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $user_id = Request::get('user_id');
     $latitude = Request::get('latitude');
     $longitude = Request::get('longitude');
     $trackdata = new Tracker();
     $trackdata->user_id = $user_id;
     $trackdata->latitude = $latitude;
     $trackdata->longitude = $longitude;
     $trackdata->save();
     return Response::json(['success' => ['message' => 'Data added.', 'status_code' => 203]], 203);
 }
开发者ID:vishnu-b,项目名称:tracker,代码行数:17,代码来源:TrackerController.php


注:本文中的Tracker::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。