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


PHP Subscriber::orderBy方法代码示例

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


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

示例1: subscribers

 public function subscribers()
 {
     $user = Sentry::getUser();
     $subscribers = Subscriber::orderBy('first_name', 'asc')->get();
     $sitename = Setting::first()->pluck('sitename');
     return View::make('dashboard.subscribers', array('user' => $user, 'subscribers' => $subscribers, 'sitename' => $sitename));
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:7,代码来源:SubscriberController.php

示例2: index

 public function index()
 {
     $minutes = 10;
     //30
     $user = Sentry::getUser();
     $sitename = Cache::remember('sitename', $minutes, function () {
         return Setting::first()->pluck('sitename');
     });
     $subscribers = Cache::remember('subscribers', $minutes, function () {
         return Subscriber::orderBy('id', 'desc')->get();
     });
     $active_subs = Cache::remember('active_subs', $minutes, function () {
         return Subscriber::where('active', '=', 1)->count();
     });
     $inactive_subs = Cache::remember('inactive_subs', $minutes, function () {
         return Subscriber::where('active', '=', 0)->count();
     });
     $percent_active = 0;
     $percent_inactive = 0;
     if ($subscribers->count() > 0) {
         $percent_active = round($active_subs / $subscribers->count() * 100);
         $percent_inactive = round($inactive_subs / $subscribers->count() * 100);
     }
     $emails_num = Cache::remember('emails_num', $minutes, function () {
         return Email::with('trackers')->count();
     });
     $email_impressions = Cache::remember('email_impressions', $minutes, function () {
         return Tracker::count();
     });
     $read_emails = Cache::remember('read_emails', $minutes, function () {
         return Tracker::where('read', '=', 1)->count();
     });
     $unread_emails = Cache::remember('unread_emails', $minutes, function () {
         return Tracker::where('read', '=', 0)->count();
     });
     $bounced_emails = Cache::remember('bounced_emails', $minutes, function () {
         return Tracker::where('bounced', '=', 1)->count();
     });
     $unsubscribed_emails = Cache::remember('unsubscribed_emails', $minutes, function () {
         return Tracker::where('unsubscribed', '=', 1)->count();
     });
     $percent_read = 0;
     $percent_unread = 0;
     $percent_bounced = 0;
     $percent_unsubscribed = 0;
     if ($email_impressions > 0) {
         $percent_read = round($read_emails / $email_impressions * 100);
         $percent_unread = round($unread_emails / $email_impressions * 100);
         $percent_bounced = round($bounced_emails / $email_impressions * 100);
         $percent_unsubscribed = round($unsubscribed_emails / $email_impressions * 100);
     }
     $browser_outof = Cache::remember('browser_outof', $minutes, function () {
         return DB::table('trackers')->select('browser', DB::raw('count(*) as total'))->groupBy('browser')->where('read', '=', 1)->orderBy('total', 'desc')->get();
     });
     $browsers_emails = Cache::remember('browsers_emails', $minutes, function () {
         return DB::table('trackers')->select('browser', DB::raw('count(*) as total'))->groupBy('browser')->where('read', '=', 1)->orderBy('total', 'desc')->take(5)->get();
     });
     $platform_outof = Cache::remember('platform_outof', $minutes, function () {
         return DB::table('trackers')->select('platform', DB::raw('count(*) as total'))->groupBy('platform')->where('read', '=', 1)->orderBy('total', 'desc')->get();
     });
     $platforms_emails = Cache::remember('platform_emails', $minutes, function () {
         return DB::table('trackers')->select('platform', DB::raw('count(*) as total'))->groupBy('platform')->where('read', '=', 1)->orderBy('total', 'desc')->take(5)->get();
     });
     $percent_browsers = [];
     $percent_platforms = [];
     if ($read_emails > 0) {
         foreach ($browsers_emails as $key => $browser) {
             $percent_browsers[] = round($browser->total / $read_emails * 100);
         }
         foreach ($platforms_emails as $key => $platform) {
             $percent_platforms[] = round($platform->total / $read_emails * 100);
         }
     }
     $subs_unsubscribed = Cache::remember('subs_unsubscribed', $minutes, function () {
         return Tracker::where('unsubscribed', '=', 1)->groupBy('subscriber_id')->get()->count();
     });
     $self_deactivated = 0;
     if ($inactive_subs > 0) {
         $self_deactivated = round($subs_unsubscribed / $inactive_subs * 100);
     }
     $admin_deactivated = 100 - $self_deactivated;
     return View::make('dashboard.index', array('user' => $user, 'sitename' => $sitename, 'emails_num' => $emails_num, 'impressions' => $email_impressions, 'read_emails' => $percent_read, 'unread_emails' => $percent_unread, 'bounced_emails' => $percent_bounced, 'unsubscribed_emails' => $unsubscribed_emails, 'browsers_emails' => $browsers_emails, 'browser_outof' => count($browser_outof), 'browsers_array' => $percent_browsers, 'platforms_emails' => $platforms_emails, 'platform_outof' => count($platform_outof), 'platforms_array' => $percent_platforms, 'subscribers' => $subscribers, 'active_subs' => $percent_active, 'inactive_subs' => $percent_inactive, 'inactive_outof' => $inactive_subs, 'self_deactivated' => $self_deactivated, 'admin_deactivated' => $admin_deactivated));
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:83,代码来源:MainController.php

示例3: select_subscribers_to_add

 public function select_subscribers_to_add($id)
 {
     $list = Addressbook::with('subscribers')->find($id);
     $subscribers = '';
     if ($list->subscribers->count() > 0) {
         $subs_array = array();
         foreach ($list->subscribers as $list_subscriber) {
             $subs_array[] = $list_subscriber->id;
         }
         $subscribers = Subscriber::whereNotIn('id', $subs_array)->orderBy('first_name', 'asc')->get();
     } else {
         $subscribers = Subscriber::orderBy('first_name', 'asc')->get();
     }
     return Response::json($subscribers);
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:15,代码来源:ListController.php


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