public function getDriverInfo() { $input = Input::all(); try { $response['status'] = "1"; $response['msg'] = "Success"; $driverHelper = new DriverHelper(); $drivers = $driverHelper->getDriverInfo($input['driver_id']); $response['drivers'] = $drivers; } catch (Exception $e) { Log::error($e); $response['status'] = '0'; $msg = (array) $e->getMessage(); $response['msg'] = $msg[0]; } return Response::json($response); }
protected function driverAndLocationInfo($input) { $response['delivery_zone'] = array(); //getting the driver information based on current meal plan $driverHelper = new DriverHelper(); $drivers = $driverHelper->getDriver(); //getting all the delivery zone in a market office $market_city_ids_arr = array(); $market_city_ids = MarketOfficeCity::select('id')->where('market_office_id', '=', Session::get('admin_market_ofc'))->get(); foreach ($market_city_ids as $eachCT) { if ($eachCT->id) { array_push($market_city_ids_arr, $eachCT->id); } } if (isset($market_city_ids_arr) && is_array($market_city_ids_arr) && count($market_city_ids_arr) > 0) { $delivery_zone = MarketOfficeCityDeliveryZones::select("id", "delivery_zone_name")->whereIn('market_office_city_id', $market_city_ids_arr)->get(); $key = 1; foreach ($delivery_zone as $val) { $response['delivery_zone'][$val["id"]] = $val; if (empty($drivers['data'][$val["id"]])) { $drivers['data'][$val["id"]] = array(); } if (empty($drivers['each_driver_count'][$val["id"]])) { $drivers['each_driver_count'][$val["id"]] = 0; } } } $response['data'] = $drivers['data']; $response['count'] = $drivers['count']; $response['meal_cat_name'] = $drivers['meal_cat_name']; $response['each_driver_count'] = $drivers['each_driver_count']; return $response; }