本文整理汇总了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.'));
}
}
}
示例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;
}
}
示例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;
}
}
示例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);
}