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


PHP Subscription::orderBy方法代码示例

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


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

示例1: get

 public function get()
 {
     $x = Subscription::orderBy('created_at', 'desc')->get();
     $data['res'] = $x;
     $data['res_type'] = 'contact messages';
     return View::make('admin.result.master.subscriber', $data);
 }
开发者ID:RainbowSeven,项目名称:la-chene,代码行数:7,代码来源:SubscriptionController.php

示例2: _getNthSub

 /**
  * Get the Nth most recent subscription for this user
  *
  * @param User    $user The user to get subscriptions for
  * @param integer $n    How far to count back
  *
  * @return Subscription a subscription or null
  */
 private function _getNthSub($user, $n)
 {
     $sub = new Subscription();
     $sub->subscriber = $user->id;
     $sub->orderBy('created DESC');
     $sub->limit($n - 1, 1);
     if ($sub->find(true)) {
         return $sub;
     } else {
         return null;
     }
 }
开发者ID:himmelex,项目名称:NTW,代码行数:20,代码来源:SubscriptionThrottlePlugin.php

示例3: realBySubscribed

 private static function realBySubscribed($subscribedId, $offset, $limit)
 {
     $sub = new Subscription();
     $sub->subscribed = $subscribedId;
     $sub->whereAdd('subscriber != ' . $subscribedId);
     $sub->orderBy('created DESC');
     $sub->limit($offset, $limit);
     $sub->find();
     $subs = array();
     while ($sub->fetch()) {
         $subs[] = clone $sub;
     }
     return $subs;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:14,代码来源:Subscription.php

示例4: liste

 /**
  * List of vats
  */
 public function liste()
 {
     $subscriptions = Subscription::orderBy('renew_at', 'ASC')->paginate(15);
     return View::make('subscription.liste', array('subscriptions' => $subscriptions));
 }
开发者ID:urashima82,项目名称:intranet,代码行数:8,代码来源:SubscriptionController.php

示例5: getSubscriptionIDs

 private static function getSubscriptionIDs($get_type, $profile_id, $offset, $limit)
 {
     switch ($get_type) {
         case 'subscribed':
             $by_type = 'subscriber';
             break;
         case 'subscriber':
             $by_type = 'subscribed';
             break;
         default:
             throw new Exception('Bad type argument to getSubscriptionIDs');
     }
     $cacheKey = 'subscription:by-' . $by_type . ':' . $profile_id;
     $queryoffset = $offset;
     $querylimit = $limit;
     if ($offset + $limit <= self::CACHE_WINDOW) {
         // Oh, it seems it should be cached
         $ids = self::cacheGet($cacheKey);
         if (is_array($ids)) {
             return array_slice($ids, $offset, $limit);
         }
         // Being here indicates we didn't find anything cached
         // so we'll have to fill it up simultaneously
         $queryoffset = 0;
         $querylimit = self::CACHE_WINDOW;
     }
     $sub = new Subscription();
     $sub->{$by_type} = $profile_id;
     $sub->selectAdd($get_type);
     $sub->whereAdd("{$get_type} != {$profile_id}");
     $sub->orderBy('created DESC');
     $sub->limit($queryoffset, $querylimit);
     if (!$sub->find()) {
         return array();
     }
     $ids = $sub->fetchAll($get_type);
     // If we're simultaneously filling up cache, remember to slice
     if ($queryoffset === 0 && $querylimit === self::CACHE_WINDOW) {
         self::cacheSet($cacheKey, $ids);
         return array_slice($ids, $offset, $limit);
     }
     return $ids;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:43,代码来源:Subscription.php

示例6: subscriptions

 function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs = false)
 {
     $this->auth_user = $apidata['user'];
     $user = $this->get_user($apidata['api_arg'], $apidata);
     if (!$user) {
         $this->clientError('Not Found', 404, $apidata['content-type']);
         return;
     }
     $page = $this->trimmed('page');
     if (!$page || !is_numeric($page)) {
         $page = 1;
     }
     $profile = $user->getProfile();
     if (!$profile) {
         $this->serverError(_('User has no profile.'));
         return;
     }
     $sub = new Subscription();
     $sub->{$user_attr} = $profile->id;
     $since = strtotime($this->trimmed('since'));
     if ($since) {
         $d = date('Y-m-d H:i:s', $since);
         $sub->whereAdd("created > '{$d}'");
     }
     $sub->orderBy('created DESC');
     if (!$onlyIDs) {
         $sub->limit(($page - 1) * 100, 100);
     }
     $others = array();
     if ($sub->find()) {
         while ($sub->fetch()) {
             $others[] = Profile::staticGet($sub->{$other_attr});
         }
     } else {
         // user has no followers
     }
     $type = $apidata['content-type'];
     $this->init_document($type);
     if ($onlyIDs) {
         $this->showIDs($others, $type);
     } else {
         $this->show_profiles($others, $type);
     }
     $this->end_document($type);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:45,代码来源:twitapistatuses.php

示例7: getNieuwsbrievenSubscriptionData

 /**
  * [getRenewalSubscriptionData]
  * @return [json] [DT compatible object]
  */
 public function getNieuwsbrievenSubscriptionData($model = null)
 {
     $Model = 'Subscription';
     $num_skip = 0;
     $num_items = 10;
     $recordsTotal = 0;
     $recordsFiltered = 0;
     // check get vars
     if (isset($_GET['start'])) {
         $num_skip = (int) $_GET['start'];
     }
     if (isset($_GET['length'])) {
         $num_items = (int) $_GET['length'];
     }
     if (isset($_GET['search'])) {
         $search_value = $_GET['search']['value'];
     }
     $all_subscriptions = Subscription::orderBy('subscriptions.id', 'DESC')->where('subscriptions.service_id', '=', Config::get('eenvoudcrm.nieuwsbrieven_service_id'))->where('subscriptions.status_id', '!=', Config::get('eenvoudcrm.subscriptions_status_terminated.id'))->where('subscriptions.status_id', '!=', Config::get('eenvoudcrm.subscriptions_status_ended.id'));
     if ($model !== null) {
         $all_subscriptions->where('subscriptions.company_id', '=', $model->id);
         if (!empty($search_value)) {
             $all_subscriptions->join('services', 'subscriptions.service_id', '=', 'services.id')->whereRaw("(services.name LIKE '%" . $search_value . "%' OR subscriptions.description LIKE '%" . $search_value . "%')");
         }
     } else {
         if (!empty($search_value)) {
             $all_subscriptions->join('companies', 'company_id', '=', 'companies.id')->join('services', 'subscriptions.service_id', '=', 'services.id')->whereRaw("(services.name LIKE '%" . $search_value . "%' OR subscriptions.description LIKE '%" . $search_value . "%' OR companies.bedrijfsnaam LIKE '%" . $search_value . "%')");
         }
     }
     $recordsTotal = $all_subscriptions->count();
     $recordsFiltered = $recordsTotal;
     if ($num_skip > 0) {
         $all_subscriptions->skip($num_skip);
     }
     $all_subscriptions = $all_subscriptions->take($num_items)->get();
     $data = [];
     foreach ($all_subscriptions as $subscription) {
         // load relations
         $load_curr_company = $subscription->company;
         $load_curr_service = $subscription->service;
         $load_curr_category = $subscription->service->category;
         $load_curr_status = $subscription->status;
         $load_curr_period = $subscription->period;
         $curr_company = $subscription->company !== NULL ? (object) ['id' => $subscription->company_id, 'bedrijfsnaam' => utf8_encode($subscription->company->bedrijfsnaam)] : (object) null;
         $curr_service = $subscription->service !== NULL ? (object) ['id' => $subscription->service_id, 'category_id' => $subscription->category_id, 'name' => utf8_encode($subscription->service->name)] : (object) null;
         $curr_category = $subscription->service->category !== NULL ? (object) ['id' => $subscription->service->category_id, 'name' => utf8_encode($subscription->service->category->name)] : (object) null;
         $curr_status = $subscription->status !== NULL ? (object) ['id' => $subscription->status_id, 'description' => utf8_encode($subscription->status->description)] : (object) null;
         $curr_period = $subscription->period !== NULL ? (object) ['id' => $subscription->invoice_periods_id, 'description' => utf8_encode($subscription->period->description)] : (object) null;
         $data[] = (object) ['DT_RowId' => 'row_' . $subscription->id, 'subscriptions' => $subscription, 'companies' => $curr_company, 'service_categories' => $curr_category, 'services' => $curr_service, 'statuses' => $curr_status, 'invoice_periods' => $curr_period];
     }
     $ret = ['recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data, 'companies' => $this->getAllCompanies(), 'services' => $this->getAllServices(), 'service_categories' => $this->getAllServiceCategories(), 'statuses' => $this->getAllStatuses(), 'invoice_periods' => $this->getAllInvoicePeriods()];
     return Response::json($ret);
 }
开发者ID:strikles,项目名称:php,代码行数:56,代码来源:AdminSubscriptionController.php

示例8: getSubscriptionData

 /**
  * [getSubscriptionData - Fetches subscription DB data and returns a json object compatible with DT]
  * @param  [string] $type   [processed/unprocessed values]
  * @return [json]           [DT compatible object]
  */
 public function getSubscriptionData($type, $company = null)
 {
     $Model = 'Subscription';
     $num_skip = 0;
     $num_items = 10;
     $recordsTotal = 0;
     $recordsFiltered = 0;
     // check get vars
     if (isset($_GET['start'])) {
         $num_skip = (int) $_GET['start'];
     }
     if (isset($_GET['length'])) {
         $num_items = (int) $_GET['length'];
     }
     if (isset($_GET['search'])) {
         $search_value = $_GET['search']['value'];
     }
     $terminated_id = Config::get('eenvoudcrm.subscriptions_status_terminated.id');
     $ended_id = Config::get('eenvoudcrm.subscriptions_status_ended.id');
     $all_subscriptions = Subscription::orderBy('subscriptions.id', 'DESC');
     if ($company !== null) {
         $all_subscriptions->where('subscriptions.company_id', '=', $company->id);
         if (!empty($search_value)) {
             $all_subscriptions->join('services', 'subscriptions.service_id', '=', 'services.id')->whereRaw("(services.name LIKE '%" . $search_value . "%' OR subscriptions.description LIKE '%" . $search_value . "%')");
         }
     } else {
         if (!empty($search_value)) {
             $all_subscriptions->join('companies', 'subscriptions.company_id', '=', 'companies.id')->join('services', 'subscriptions.service_id', '=', 'services.id')->whereRaw("(services.name LIKE '%" . $search_value . "%' OR subscriptions.description LIKE '%" . $search_value . "%' OR companies.bedrijfsnaam LIKE '%" . $search_value . "%')");
         }
     }
     if ($type === 'unprocessed') {
         $all_subscriptions->whereRaw('(subscriptions.invoice_id IS NULL AND subscriptions.status_id != ' . $terminated_id . ' AND subscriptions.status_id != ' . $ended_id . ')');
     } elseif ($type === 'processed') {
         $all_subscriptions->whereRaw('(subscriptions.invoice_id IS NOT NULL OR subscriptions.status_id = ' . $terminated_id . ' OR subscriptions.status_id = ' . $ended_id . ')');
     } else {
         error_log('Error: No type specified');
         return;
     }
     $recordsTotal = $all_subscriptions->count();
     $recordsFiltered = $recordsTotal;
     if ($num_skip > 0) {
         $all_subscriptions->skip($num_skip);
     }
     $all_subscriptions = $all_subscriptions->take($num_items)->get();
     $data = [];
     foreach ($all_subscriptions as $subscription) {
         // load relations
         $load_curr_company = $subscription->company;
         $load_curr_service = $subscription->service;
         $load_curr_category = $subscription->service->category;
         $load_curr_status = $subscription->status;
         $curr_company = $subscription->company !== NULL ? (object) ['id' => $subscription->company_id, 'bedrijfsnaam' => utf8_encode($subscription->company->bedrijfsnaam)] : (object) null;
         $curr_service = $subscription->service !== NULL ? (object) ['id' => $subscription->service_id, 'category_id' => $subscription->category_id, 'name' => utf8_encode($subscription->service->name)] : (object) null;
         $curr_category = $subscription->service->category !== NULL ? (object) ['id' => $subscription->service->category_id, 'name' => utf8_encode($subscription->service->category->name)] : (object) null;
         $curr_status = $subscription->status !== NULL ? (object) ['id' => $subscription->status_id, 'description' => utf8_encode($subscription->status->description)] : (object) null;
         $data[] = (object) ['DT_RowId' => 'row_' . $subscription->id, 'subscriptions' => $subscription, 'companies' => $curr_company, 'service_categories' => $curr_category, 'services' => $curr_service, 'statuses' => $curr_status];
     }
     $ret = ['recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data, 'companies' => $this->getAllCompanies(), 'services' => $this->getAllServices(), 'service_categories' => $this->getAllServiceCategories(), 'statuses' => $this->getAllStatuses()];
     return Response::json($ret);
 }
开发者ID:strikles,项目名称:php,代码行数:65,代码来源:AdminAccountingController.php


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