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


PHP Activity::orderBy方法代码示例

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


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

示例1: insc

 public function insc()
 {
     $events = Event::orderBy('name')->get();
     $activitiesNotInsc = Activity::orderBy('name')->get();
     $activitiesInsc = Activity::orderBy('name')->get();
     return view('activitiesevent', compact('events', 'activitiesInsc', 'activitiesNotInsc'));
 }
开发者ID:leloulight,项目名称:CTFlor,代码行数:7,代码来源:EventController.php

示例2: activities

 public function activities()
 {
     $this->data['activities'] = Activity::orderBy('id', 'desc')->paginate(25);
     return $this->layout->content = View::make('activities', $this->data);
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:5,代码来源:ActivitiesController.php

示例3: createTimeBinsForActivity

 public function createTimeBinsForActivity()
 {
     $g = [];
     $activities = Activity::orderBy('created_at', 'desc')->get();
     $prevRow = null;
     $lastGroup = array();
     foreach ($activities as &$row) {
         if (count($g) == 0) {
             $uid = "{$row->user_id}" . "_" . $row->created_at->getTimestamp();
             $g[$uid] = array($row);
         } else {
             $group_to_add_to = -1;
             $group_index = 0;
             // we only want to search to group acts together
             // if the activity is of the same type of event
             // but not a 'new spot'
             // and is a close enough time period (3 mins)
             // and from the same user
             if ($row->event !== 'activity.user.commented' && $row->event !== 'activity.spot.created') {
                 foreach ($g as $key => &$group) {
                     foreach ($group as &$act) {
                         if ($row->user_id == $act->user_id && $row->created_at->diffInMinutes($act->created_at) <= 30 && $row->event == $act->event) {
                             $group_to_add_to = $key;
                             break;
                         }
                     }
                     $group_index++;
                 }
             }
             if ($group_to_add_to == -1) {
                 $uid = "{$row->user_id}" . "_" . $row->created_at->getTimestamp();
                 $g[$uid] = array($row);
             } else {
                 array_push($g[$group_to_add_to], $row);
             }
         }
     }
     foreach ($g as $key => &$group) {
         foreach ($group as &$act) {
             $act->timestamps = false;
             $act->event_id = $key;
             $act->save();
         }
     }
     return new Collection($g);
 }
开发者ID:vanderlin,项目名称:halp,代码行数:46,代码来源:LOFaker.php


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