本文整理汇总了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);
}
}