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


PHP route::where方法代码示例

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


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

示例1: postLocation

 /**
  * controller buat handle request post ke URI /report_location
  * attribut post ada rute_id, lat, long, speed, semua dikirim plain form request
  *
  * @param Request $requests
  * @return \Illuminate\Http\JsonResponse
  */
 public function postLocation(Request $requests)
 {
     $routeModel = new route();
     $plat = $requests->input('plat');
     $this->plat_nomor = $plat;
     $input_token = $requests->input('token');
     $bus = new BusOperation();
     $reference_token = $bus->select('token')->where('plat_nomor', '=', $plat)->get()->toArray();
     try {
         if ($input_token == $reference_token[0]['token']) {
             $location = new StoreLocationModel();
             $location->route_id = $requests->input('rute_id');
             $this->rute_id = $requests->input('rute_id');
             $routeModel->where('rute_id', '=', $this->rute_id)->firstOrFail();
             $flagCheck = $this->checkBusIteration();
             $location->latitude = $requests->input('lat');
             $this->busLat = $requests->input('lat');
             $location->longitude = $requests->input('long');
             $this->busLon = $requests->input('long');
             $location->avg_speed = $requests->input('speed');
             $this->avg_speed = $requests->input('speed');
             $location->plat_nomor = $plat;
             $location->save();
             if ($flagCheck) {
                 if ($location->save()) {
                     $this->getLastBusStop();
                     $this->selectBusHistory();
                     try {
                         $this->getAllBusStop();
                     } catch (\Exception $e) {
                         $this->response['data']['msg'] = 'internal error, cannot make request to third pary service or temporary connection down, please try again or report it';
                         $this->response['code'] = 500;
                         header("Access-Control-Allow-Origin: *");
                         return response()->json($this->response);
                     }
                     $this->updateBusOperation();
                     $this->checkBusLocationStatus();
                     $this->checkBusStopHistory();
                     $this->detectSpeedViolation();
                     //all operation successfull
                     header("Access-Control-Allow-Origin: *");
                     return response()->json($this->response);
                 } else {
                     $this->response['data']['msg'] = 'internal error, cannot save data to database, please try again or report it';
                     $this->response['code'] = 500;
                     header("Access-Control-Allow-Origin: *");
                     return response()->json($this->response);
                 }
             } else {
                 $this->updateBusOperation();
                 $this->response['code'] = 200;
                 $this->response['data']['msg'] = 'update bus coordinate location';
                 header("Access-Control-Allow-Origin: *");
                 return response()->json($this->response);
             }
         } else {
             $this->response['data']['msg'] = 'transaction failed, make sure you enter a valid token';
             $this->response['code'] = 400;
             header("Access-Control-Allow-Origin: *");
             return response()->json($this->response);
         }
     } catch (\Exception $e) {
         $this->response['data']['msg'] = 'one or more of your parameter value is invalid, make sure you send correct parameter';
         $this->response['code'] = 400;
         header("Access-Control-Allow-Origin: *");
         return response()->json($this->response);
     }
 }
开发者ID:radityacandra,项目名称:passenger_information_system,代码行数:75,代码来源:StoreLocationController.php


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