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


PHP Orders::findFirst方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $dateSelected = "";
     $sqlWithDate = "";
     if ($this->request->getPost()) {
         $dateSelected = $this->request->getPost('date');
         $sqlWithDate = " AND date_created = '{$dateSelected}'";
         $today = Carbon::now()->toDateString();
     }
     $hours = ['09' => ['hours' => '09', 'desc' => '09:00 - 10:00'], '10' => ['hours' => '10', 'desc' => '10:00 - 11:00'], '11' => ['hours' => '11', 'desc' => '11:00 - 12:00'], '12' => ['hours' => '12', 'desc' => '12:00 - 13:00'], '13' => ['hours' => '13', 'desc' => '13:00 - 14:00'], '14' => ['hours' => '14', 'desc' => '14:00 - 15:00'], '15' => ['hours' => '15', 'desc' => '15:00 - 16:00'], '16' => ['hours' => '16', 'desc' => '16:00 - 17:00'], '17' => ['hours' => '17', 'desc' => '17:00 - 18:00'], '18' => ['hours' => '18', 'desc' => '18:00 - 19:00'], '19' => ['hours' => '19', 'desc' => '19:00 - 20:00'], '20' => ['hours' => '20', 'desc' => '20:00 - 21:00'], '21' => ['hours' => '21', 'desc' => '21:00 - 22:00']];
     $stadium = [];
     $userID = "";
     for ($i = 1; $i <= 8; $i++) {
         foreach ($hours as $key => $value) {
             $order = Orders::findFirst("stadium = '{$i}' AND start_hour = '{$key}' {$sqlWithDate}");
             $link = "<a href=\"/process/add/{$i}/{$key}/{$this->session->get('user_id')}\" class=\"btn-xs btn-success\">Book Now</a>";
             $name = $link;
             if (isset($order->user_id)) {
                 $name = "<a class=\"btn-xs btn-default\">{$order->Userss->name}</a>";
                 if ($order->user_id == $this->session->get('user_id')) {
                     $name = "<a class=\"btn-xs btn-warning\">Yours</a>";
                 }
                 $userID = isset($order->user_id) ? $order->user_id : "";
             }
             if ($dateSelected < $today) {
                 $name = "<a class=\"btn-xs btn-danger\">Expired Book</a>";
             }
             $stadium[$key][$i] = ['desc' => $value['desc'], 'userId' => $userID, 'name' => $name];
         }
     }
     $this->view->setVar('data', $stadium);
     $this->view->setVar('dateSelected', $dateSelected . " (yy-mm-dd)");
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:33,代码来源:DashboardController.php

示例2: updateAction

 public function updateAction($oid)
 {
     $auth = $this->session->get('auth');
     $cid = $auth[cid];
     if ($cid == false) {
         $this->response->redirect("404");
     } else {
         $order = Orders::findFirst(array("(o_id = :oid:)", 'bind' => array('oid' => $oid)));
         $order->o_delivery = 1;
         if ($order->save() != false) {
             return $this->response->redirect('orders');
         }
     }
 }
开发者ID:redefiningcuriosity,项目名称:rms,代码行数:14,代码来源:OrdersController.php


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