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


PHP Events::orderBy方法代码示例

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


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

示例1: getManageEvent

 public function getManageEvent()
 {
     $events = Events::orderBy('start', 'ASC')->get();
     foreach ($events as $event) {
         $times = array("start", "finish");
         for ($i = 0; $i < sizeof($times); $i++) {
             $strDate = $event->{$times}[$i];
             $strYear = date("Y", strtotime($strDate)) + 543;
             $strMonth = date("n", strtotime($strDate));
             $strDay = date("j", strtotime($strDate));
             $strHour = date("H", strtotime($strDate));
             $strMinute = date("i", strtotime($strDate));
             $strSeconds = date("s", strtotime($strDate));
             $strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
             $strMonthThai = $strMonthCut[$strMonth];
             $event->{$times}[$i] = "{$strDay} {$strMonthThai} {$strYear}, {$strHour}:{$strMinute}";
         }
     }
     return View::make('admin.manage_event')->with('events', $events);
 }
开发者ID:pchaow,项目名称:pportal,代码行数:20,代码来源:AdminController.php

示例2: filterEvents

 public function filterEvents()
 {
     $location = Input::get('location');
     if ($location == "ทั้งหมด") {
         $events = Events::orderBy('start', 'ASC')->get();
     } else {
         $events = Events::where('location', $location)->orderBy('start', 'ASC')->get();
     }
     foreach ($events as $event) {
         date_default_timezone_set('Asia/Bangkok');
         $date11 = $event->start;
         $date21 = $event->finish;
         if (date("Y-m-d H:i:s") < $date11) {
             $date1 = new DateTime($date11);
             $date2 = new DateTime(date("Y-m-d H:i:s"));
             $interval = $date2->diff($date1);
             if ($interval->days == 0) {
                 $event['status'] = "-3";
                 $event['hr'] = $interval->h;
             } else {
                 //$event['status'] = $interval->days;
                 $event['status'] = "-3";
             }
             //$event['status'] = $interval->days;
         } elseif (date("Y-m-d H:i:s") >= $date11 && date("Y-m-d H:i:s") <= $date21) {
             $event['status'] = "-1";
         } elseif (date("Y-m-d H:i:s") >= $date21) {
             $event['status'] = "-2";
         } else {
             $event['status'] = "9999";
         }
         $start = new DateTime($date11);
         $finish = new DateTime($date21);
         $interval1 = $start->diff($finish);
         //dd($event->start);
         if ($interval1->days < 1) {
             $strDate = $event->start;
             $strYear = date("Y", strtotime($strDate)) + 543;
             $strMonth = date("n", strtotime($strDate));
             $strDay = date("j", strtotime($strDate));
             $strHour = date("H", strtotime($strDate));
             $strMinute = date("i", strtotime($strDate));
             $strSeconds = date("s", strtotime($strDate));
             $strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
             $strMonthThai = $strMonthCut[$strMonth];
             $event['format'] = "{$strDay} {$strMonthThai} {$strYear}";
         } elseif ($interval1->days > 0) {
             if ($strMonth = date("n", strtotime($event->start)) == ($strMonth = date("n", strtotime($event->finish)))) {
                 $strDate = $event->start;
                 $strYear = date("Y", strtotime($strDate)) + 543;
                 $strMonth = date("n", strtotime($strDate));
                 $strDay = date("j", strtotime($strDate));
                 $strHour = date("H", strtotime($strDate));
                 $strMinute = date("i", strtotime($strDate));
                 $strSeconds = date("s", strtotime($strDate));
                 $strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
                 $strMonthThai = $strMonthCut[$strMonth];
                 $strDayFinish = date("j", strtotime($event->finish));
                 $event['format'] = "{$strDay} - {$strDayFinish} {$strMonthThai} {$strYear}";
             } else {
                 $strDate = $event->start;
                 $strYear = date("Y", strtotime($strDate)) + 543;
                 $strMonth = date("n", strtotime($strDate));
                 $strDay = date("j", strtotime($strDate));
                 $strHour = date("H", strtotime($strDate));
                 $strMinute = date("i", strtotime($strDate));
                 $strSeconds = date("s", strtotime($strDate));
                 $strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
                 $strMonthThai = $strMonthCut[$strMonth];
                 $strDayFinish = date("j", strtotime($event->finish));
                 $strMonthFinish = date("n", strtotime($event->finish));
                 $event['format'] = "{$strDay} {$strMonthThai} - {$strDayFinish} {$strMonthCut[$strMonthFinish]} {$strYear}";
             }
         }
         $times = array("start", "finish");
         for ($i = 0; $i < sizeof($times); $i++) {
             $strDate = $event->{$times}[$i];
             $strYear = date("Y", strtotime($strDate)) + 543;
             $strMonth = date("n", strtotime($strDate));
             $strDay = date("j", strtotime($strDate));
             $strHour = date("H", strtotime($strDate));
             $strMinute = date("i", strtotime($strDate));
             $strSeconds = date("s", strtotime($strDate));
             $strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
             $strMonthThai = $strMonthCut[$strMonth];
             $event->{$times}[$i] = "{$strDay} {$strMonthThai} - {$strDayFinish} {$strMonthCut[$strMonthFinish]} {$strYear} เวลา {$strHour}:{$strMinute} น.";
             //$event['stat'] = 'newenw';
         }
     }
     foreach ($events as $event) {
         if ($event->status != -2 && $event->status == -1) {
             echo "<div class=\"col-xs-12 col-sx-6 col-sm-6 col-md-6 col-lg-4\">\n                      <div class=\"feature\">\n                          <a href=\"/events/{$event->id}/show\">\n                              <div class=\"event-title\">\n                                  {$event->name}\n                              </div>\n                              <div class=\"event-img\">\n                                  <img class=\"lazy img-responsive\" data-original=\"/uploads/events/{$event->img}\" alt=\"BMW M1 Hood\" src=\"/uploads/events/{$event->img}\" style=\"display: block;\">\n\n                              </div>\n                              <div class=\"event-desc\">";
             if (!$event->repeat) {
                 echo "<p>{$event->format}</p>\n                                      <p>@ {$event->where}, {$event->location}</p>";
             } else {
                 echo "<p>ทุก{$event->day} เริ่ม {$event->start}</p>\n                                      <p>@ {$event->where}, {$event->location}</p>";
             }
             echo "</div>\n                          </a>\n                      </div>\n                  </div>";
         }
     }
//.........这里部分代码省略.........
开发者ID:pchaow,项目名称:pportal,代码行数:101,代码来源:HomeController.php

示例3:

@extends('layouts.qlm_administrator')
@section('content')
<?php 
$_countPage = DB::table('qlm_events')->count();
$_resultPage1st = Events::orderBy('eventDate', 'desc')->get();
?>
        <!-- Page Heading -->
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">
            List of events
        </h1>
    </div>
</div>
<!-- /.row -->
<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-3">
                        <i class="fa fa-edit fa-5x"></i>
                    </div>
                    <div class="col-xs-9 text-right">
                        <div class="huge">{{ $_countPage }}</div>
                        <div>events in database!</div>
                    </div>
                </div>
            </div>
            <a href="{{asset('qlm-admin/add-new-events')}}">
                <div class="panel-footer">
开发者ID:ndmson,项目名称:QLM,代码行数:31,代码来源:events.blade.php


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