public function get_request_location()
 {
     $request_id = Input::get('request_id');
     $token = Input::get('token');
     $owner_id = Input::get('id');
     $validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'owner_id' => $owner_id), array('request_id' => 'required|integer', 'token' => 'required', 'owner_id' => 'required|integer'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         $is_admin = $this->isAdmin($token);
         if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
             // check for token validity
             if (is_token_active($owner_data->token_expiry) || $is_admin) {
                 // Do necessary operations
                 if ($request = Requests::find($request_id)) {
                     if ($request->owner_id == $owner_data->id) {
                         if ($request->confirmed_walker != 0) {
                             if ($request->is_started == 0) {
                                 $walker = Walker::find($request->confirmed_walker);
                                 $distance = 0;
                             } else {
                                 $walker = WalkLocation::where('request_id', $request->id)->orderBy('created_at', 'desc')->first();
                                 $distance = $walker->distance;
                             }
                             $settings = Settings::where('key', 'default_distance_unit')->first();
                             $unit = $settings->value;
                             $distance = convert($distance, $unit);
                             $response_array = array('success' => true, 'latitude' => $walker->latitude, 'longitude' => $walker->longitude, 'distance' => $distance);
                         } else {
                             $response_array = array('success' => false, 'error' => 'Walker not Confirmed yet', 'error_code' => 421);
                         }
                         $response_code = 200;
                     } else {
                         $response_array = array('success' => false, 'error' => 'Request ID doesnot matches with Owner ID', 'error_code' => 407);
                         $response_code = 200;
                     }
                 } else {
                     $response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 408);
                     $response_code = 200;
                 }
             } else {
                 $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
                 $response_code = 200;
             }
         } else {
             if ($is_admin) {
                 $response_array = array('success' => false, 'error' => 'Owner ID not Found', 'error_code' => 410);
             } else {
                 $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
             }
             $response_code = 200;
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
 public function userTripDetail()
 {
     $id = Request::segment(3);
     $owner_id = Session::get('user_id');
     $request = Requests::find($id);
     if ($request->owner_id == $owner_id) {
         $locations = WalkLocation::where('request_id', $id)->orderBy('id')->get();
         $start = WalkLocation::where('request_id', $id)->orderBy('id')->first();
         $end = WalkLocation::where('request_id', $id)->orderBy('id', 'desc')->first();
         $map = "https://maps-api-ssl.google.com/maps/api/staticmap?size=249x249&style=feature:landscape|visibility:off&style=feature:poi|visibility:off&style=feature:transit|visibility:off&style=feature:road.highway|element:geometry|lightness:39&style=feature:road.local|element:geometry|gamma:1.45&style=feature:road|element:labels|gamma:1.22&style=feature:administrative|visibility:off&style=feature:administrative.locality|visibility:on&style=feature:landscape.natural|visibility:on&scale=2&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/marker-start@2x.png|{$start->latitude},{$start->longitude}&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/marker-finish@2x.png|{$end->latitude},{$end->longitude}&path=color:0x2dbae4ff|weight:4";
         foreach ($locations as $location) {
             $map .= "|{$location->latitude},{$location->longitude}";
         }
         $start_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$start->latitude},{$start->longitude}"), TRUE);
         $start_address = $start_location['results'][0]['formatted_address'];
         $end_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$end->latitude},{$end->longitude}"), TRUE);
         $end_address = $end_location['results'][0]['formatted_address'];
         $walker = Walker::find($request->confirmed_walker);
         $walker_review = WalkerReview::where('request_id', $id)->first();
         if ($walker_review) {
             $rating = round($walker_review->rating);
         } else {
             $rating = 0;
         }
         return View::make('web.userTripDetail')->with('title', 'My Trips')->with('request', $request)->with('start_address', $start_address)->with('end_address', $end_address)->with('start', $start)->with('end', $end)->with('map_url', $map)->with('walker', $walker)->with('rating', $rating);
     } else {
         echo "false";
     }
 }
 public function paybypaypal()
 {
     $token = Input::get('token');
     $owner_id = Input::get('id');
     $request_id = Input::get('request_id');
     $paypal_id = Input::get('paypal_id');
     $validator = Validator::make(array('token' => $token, 'owner_id' => $owner_id, 'paypal_id' => $paypal_id), array('token' => 'required', 'owner_id' => 'required|integer', 'paypal_id' => 'required'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         $is_admin = $this->isAdmin($token);
         if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
             // check for token validity
             if (is_token_active($owner_data->token_expiry) || $is_admin) {
                 Log::info('paypal_id = ' . print_r($paypal_id, true));
                 $req = Requests::find($request_id);
                 Log::info('req = ' . print_r($req, true));
                 $req->is_paid = 1;
                 $req->payment_id = $paypal_id;
                 $req->save();
                 $response_array = array('success' => true);
                 $response_code = 200;
             }
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
예제 #4
0
 public function charge_user($id)
 {
     $request = Requests::find($id);
     Log::info('Charge User from admin');
     $total = $request->total;
     $payment_data = Payment::where('owner_id', $request->owner_id)->first();
     $customer_id = $payment_data->customer_id;
     $setransfer = Settings::where('key', 'transfer')->first();
     $transfer_allow = $setransfer->value;
     if (Config::get('app.default_payment') == 'stripe') {
         //dd($customer_id);
         Stripe::setApiKey(Config::get('app.stripe_secret_key'));
         try {
             $charge = Stripe_Charge::create(array("amount" => $total * 100, "currency" => "usd", "customer" => $customer_id));
             Log::info('charge stripe = ' . print_r($charge, true));
         } catch (Stripe_InvalidRequestError $e) {
             // Invalid parameters were supplied to Stripe's API
             $ownr = Owner::find($request->owner_id);
             $ownr->debt = $total;
             $ownr->save();
             $response_array = array('error' => $e->getMessage());
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
         $request->is_paid = 1;
         $settng = Settings::where('key', 'service_fee')->first();
         $settng_mode = Settings::where('key', 'payment_mode')->first();
         if ($settng_mode->value == 2 and $transfer_allow == 1) {
             $transfer = Stripe_Transfer::create(array("amount" => ($total - $settng->value) * 100, "currency" => "usd", "recipient" => $walker_data->merchant_id));
             $request->transfer_amount = $total - $settng->value;
         }
     } else {
         try {
             Braintree_Configuration::environment(Config::get('app.braintree_environment'));
             Braintree_Configuration::merchantId(Config::get('app.braintree_merchant_id'));
             Braintree_Configuration::publicKey(Config::get('app.braintree_public_key'));
             Braintree_Configuration::privateKey(Config::get('app.braintree_private_key'));
             if ($settng_mode->value == 2 and $transfer_allow == 1) {
                 $sevisett = Settings::where('key', 'service_fee')->first();
                 $service_fee = $sevisett->value;
                 $result = Braintree_Transaction::sale(array('amount' => $total - $service_fee, 'paymentMethodNonce' => $customer_id, 'merchantAccountId' => $walker_data->merchant_id, 'options' => array('submitForSettlement' => true, 'holdInEscrow' => true), 'serviceFeeAmount' => $service_fee));
             } else {
                 $result = Braintree_Transaction::sale(array('amount' => $total, 'paymentMethodNonce' => $customer_id));
             }
             Log::info('result of braintree = ' . print_r($result, true));
             if ($result->success) {
                 $request->is_paid = 1;
             } else {
                 $request->is_paid = 0;
             }
         } catch (Exception $e) {
             Log::info('error in braintree payment = ' . print_r($e, true));
         }
     }
     $request->card_payment = $total;
     $request->ledger_payment = $request->total - $total;
     $request->save();
     return Redirect::to('/admin/requests');
 }
 public function walk_location()
 {
     if (Request::isMethod('post')) {
         $request_id = Input::get('request_id');
         $token = Input::get('token');
         $walker_id = Input::get('id');
         $latitude = Input::get('latitude');
         $longitude = Input::get('longitude');
         $validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'walker_id' => $walker_id, 'latitude' => $latitude, 'longitude' => $longitude), array('request_id' => 'required|integer', 'token' => 'required', 'walker_id' => 'required|integer', 'latitude' => 'required', 'longitude' => 'required'));
         if ($validator->fails()) {
             $error_messages = $validator->messages()->all();
             $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
             $response_code = 200;
         } else {
             $is_admin = $this->isAdmin($token);
             if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
                 // check for token validity
                 if (is_token_active($walker_data->token_expiry) || $is_admin) {
                     // Do necessary operations
                     if ($request = Requests::find($request_id)) {
                         if ($request->confirmed_walker == $walker_id) {
                             if ($request->is_started == 1) {
                                 $walk_location_last = WalkLocation::where('request_id', $request_id)->orderBy('created_at', 'desc')->first();
                                 if ($walk_location_last) {
                                     $distance_old = $walk_location_last->distance;
                                     $distance_new = distanceGeoPoints($walk_location_last->latitude, $walk_location_last->longitude, $latitude, $longitude);
                                     $distance = $distance_old + $distance_new;
                                     $settings = Settings::where('key', 'default_distance_unit')->first();
                                     $unit = $settings->value;
                                     $distance = $distance;
                                 } else {
                                     $distance = 0;
                                 }
                                 $walk_location = new WalkLocation();
                                 $walk_location->request_id = $request_id;
                                 $walk_location->latitude = $latitude;
                                 $walk_location->longitude = $longitude;
                                 $walk_location->distance = $distance;
                                 $walk_location->save();
                                 $response_array = array('success' => true, 'distance' => $distance);
                                 $response_code = 200;
                             } else {
                                 $response_array = array('success' => false, 'error' => 'Walk not yet started', 'error_code' => 414);
                                 $response_code = 200;
                             }
                         } else {
                             $response_array = array('success' => false, 'error' => 'Request ID doesnot matches with Walker ID', 'error_code' => 407);
                             $response_code = 200;
                         }
                     } else {
                         $response_array = array('success' => false, 'error' => 'Walk ID Not Found', 'error_code' => 408);
                         $response_code = 200;
                     }
                 } else {
                     $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
                     $response_code = 200;
                 }
             } else {
                 if ($is_admin) {
                     $response_array = array('success' => false, 'error' => 'Walker ID not Found', 'error_code' => 410);
                 } else {
                     $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
                 }
                 $response_code = 200;
             }
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
 public function walk_location()
 {
     if (Request::isMethod('post')) {
         $request_id = Input::get('request_id');
         $token = Input::get('token');
         $walker_id = Input::get('id');
         $latitude = Input::get('latitude');
         $longitude = Input::get('longitude');
         if (Input::has('bearing')) {
             $angle = Input::get('bearing');
         }
         $validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'walker_id' => $walker_id, 'latitude' => $latitude, 'longitude' => $longitude), array('request_id' => 'required|integer', 'token' => 'required', 'walker_id' => 'required|integer', 'latitude' => 'required', 'longitude' => 'required'));
         if ($validator->fails()) {
             $error_messages = $validator->messages()->all();
             $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
             $response_code = 200;
         } else {
             $unit = $unit_set = -1;
             $settings = Settings::where('key', 'default_distance_unit')->first();
             $unit = $settings->value;
             if ($unit == 0) {
                 $unit_set = 'kms';
             } elseif ($unit == 1) {
                 $unit_set = 'miles';
             }
             $is_admin = $this->isAdmin($token);
             if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
                 // check for token validity
                 if (is_token_active($walker_data->token_expiry) || $is_admin) {
                     // Do necessary operations
                     if ($request = Requests::find($request_id)) {
                         if ($request->confirmed_walker == $walker_id) {
                             if ($request->is_started == 1) {
                                 $walk_location_last = WalkLocation::where('request_id', $request_id)->orderBy('created_at', 'desc')->first();
                                 if ($walk_location_last) {
                                     $distance_old = $walk_location_last->distance;
                                     $distance_new = distanceGeoPoints($walk_location_last->latitude, $walk_location_last->longitude, $latitude, $longitude);
                                     $distance = $distance_old + $distance_new;
                                     $settings = Settings::where('key', 'default_distance_unit')->first();
                                     $unit = $settings->value;
                                     if ($unit == 0) {
                                         $unit_set = 'kms';
                                     } elseif ($unit == 1) {
                                         $unit_set = 'miles';
                                     }
                                     $distancecon = convert($distance, $unit);
                                 } else {
                                     $distance = 0;
                                 }
                                 $walker = Walker::find($walker_id);
                                 $location = get_location($latitude, $longitude);
                                 $latitude = $location['lat'];
                                 $longitude = $location['long'];
                                 if (!isset($angle)) {
                                     $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude);
                                 }
                                 $walker->old_latitude = $walker->latitude;
                                 $walker->old_longitude = $walker->longitude;
                                 $walker->latitude = $latitude;
                                 $walker->longitude = $longitude;
                                 $walker->bearing = $angle;
                                 $walker->save();
                                 /* GET SECOND LAST ENTY FOR TIME */
                                 $loc1 = WalkLocation::where('request_id', $request->id)->orderBy('id', 'desc')->first();
                                 /* GET SECOND LAST ENTY FOR TIME END */
                                 if ($request->is_completed != 1) {
                                     $walk_location = new WalkLocation();
                                     $walk_location->request_id = $request_id;
                                     $walk_location->latitude = $latitude;
                                     $walk_location->longitude = $longitude;
                                     $walk_location->distance = $distance;
                                     $walk_location->bearing = $angle;
                                     $walk_location->save();
                                 }
                                 $one_minut_old_time = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) - 60);
                                 /* $loc1 = WalkLocation::where('request_id', $request->id)->first(); */
                                 /* print $loc1; */
                                 $loc2 = WalkLocation::where('request_id', $request->id)->orderBy('id', 'desc')->first();
                                 if ($loc1) {
                                     $time1 = strtotime($loc2->created_at);
                                     $time2 = strtotime($loc1->created_at);
                                     /* echo $difference = intval(($time1 - $time2) / 60); */
                                     $difference = ($time1 - $time2) / 60;
                                     $loc1min = WalkLocation::where('request_id', $request->id)->where('created_at', '<=', $one_minut_old_time)->orderBy('id', 'desc')->first();
                                     $distence = distanceGeoPoints($loc1min->latitude, $loc1min->longitude, $latitude, $longitude);
                                     if ($request->is_completed != 1) {
                                         if ($distence <= 50) {
                                             $request->time = $request->time + $difference;
                                         } else {
                                             $request->time = $request->time;
                                         }
                                     }
                                 } else {
                                     $request->time = 0;
                                 }
                                 $request->save();
                                 $response_array = array('success' => true, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $request->payment_mode, 'is_cancelled' => $request->is_cancelled, 'distance' => $distancecon, 'unit' => $unit_set, 'time' => $difference);
                                 $response_code = 200;
                             } else {
                                 $walker = Walker::find($walker_id);
                                 $location = get_location($latitude, $longitude);
                                 $latitude = $location['lat'];
                                 $longitude = $location['long'];
                                 if (!isset($angle)) {
                                     $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude);
                                 }
                                 $walker->old_latitude = $walker->latitude;
                                 $walker->old_longitude = $walker->longitude;
                                 $walker->latitude = $latitude;
                                 $walker->longitude = $longitude;
                                 $walker->bearing = $angle;
                                 $walker->save();
                                 $response_array = array('success' => false, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $owner->payment_mode, 'is_cancelled' => $request->is_cancelled, 'unit' => $unit_set, 'error' => 'Service not yet started', 'error_code' => 414);
                                 $response_code = 200;
                             }
                         } else {
                             /* $var = Keywords::where('id', 1)->first();
                                $response_array = array('success' => false, 'error' => 'Request ID doesnot matches with ' . $var->keyword . ' ID', 'error_code' => 407); */
                             $response_array = array('success' => false, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $owner->payment_mode, 'is_cancelled' => $request->is_cancelled, 'unit' => $unit_set, 'error' => 'Request ID doesnot matches with ' . Config::get('app.generic_keywords.Provider') . ' ID', 'error_code' => 407);
                             $response_code = 200;
                         }
                     } else {
                         $response_array = array('success' => false, 'error' => 'Service ID Not Found', 'error_code' => 408);
                         $response_code = 200;
                     }
                 } else {
                     $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
                     $response_code = 200;
                 }
             } else {
                 if ($is_admin) {
                     /* $var = Keywords::where('id', 1)->first();
                        $response_array = array('success' => false, 'error' => '' . $var->keyword . ' ID not Found', 'error_code' => 410); */
                     $response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.Provider') . ' ID not Found', 'error_code' => 410);
                 } else {
                     $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
                 }
                 $response_code = 200;
             }
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
예제 #7
0
 public function user_set_destination()
 {
     $request_id = Input::get('request_id');
     $token = Input::get('token');
     $owner_id = Input::get('id');
     $dest_lat = Input::get('dest_lat');
     $dest_long = Input::get('dest_long');
     $validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'owner_id' => $owner_id, 'dest_lat' => $dest_lat, 'dest_long' => $dest_long), array('request_id' => 'required|integer', 'token' => 'required', 'owner_id' => 'required|integer', 'dest_lat' => 'required', 'dest_long' => 'required'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         $is_admin = $this->isAdmin($token);
         if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
             // check for token validity
             if (is_token_active($owner_data->token_expiry) || $is_admin) {
                 // Do necessary operations
                 if ($request = Requests::find($request_id)) {
                     if ($request->owner_id == $owner_data->id) {
                         Requests::where('id', $request_id)->update(array('D_latitude' => $dest_lat, 'D_longitude' => $dest_long));
                         if ($request->current_walker) {
                             $msg_array = array();
                             $msg_array['request_id'] = $request_id;
                             $msg_array['unique_id'] = 4;
                             $last_destination = Requests::find($request_id);
                             $owner = Owner::find($owner_id);
                             $request_data = array();
                             $request_data['owner'] = array();
                             $request_data['owner']['name'] = $owner->first_name . " " . $owner->last_name;
                             $request_data['owner']['picture'] = $owner->picture;
                             $request_data['owner']['phone'] = $owner->phone;
                             $request_data['owner']['address'] = $owner->address;
                             $request_data['owner']['latitude'] = $owner->latitude;
                             $request_data['owner']['longitude'] = $owner->longitude;
                             $request_data['owner']['dest_latitude'] = $last_destination->D_latitude;
                             $request_data['owner']['dest_longitude'] = $last_destination->D_longitude;
                             $request_data['owner']['rating'] = $owner->rate;
                             $request_data['owner']['num_rating'] = $owner->rate_count;
                             $request_data['dog'] = array();
                             if ($dog = Dog::find($owner->dog_id)) {
                                 $request_data['dog']['name'] = $dog->name;
                                 $request_data['dog']['age'] = $dog->age;
                                 $request_data['dog']['breed'] = $dog->breed;
                                 $request_data['dog']['likes'] = $dog->likes;
                                 $request_data['dog']['picture'] = $dog->image_url;
                             }
                             $msg_array['request_data'] = $request_data;
                             $title = "Set Destination";
                             $message = $msg_array;
                             if ($request->confirmed_walker == $request->current_walker) {
                                 send_notifications($request->confirmed_walker, "walker", $title, $message);
                             }
                         }
                         $response_array = array('success' => true, 'error' => "Destination Set Successfully");
                         $response_code = 200;
                     } else {
                         $response_array = array('success' => false, 'error' => 'Request ID doesnot matches with Owner ID', 'error_code' => 407);
                         $response_code = 200;
                     }
                 } else {
                     $response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 408);
                     $response_code = 200;
                 }
             } else {
                 $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
                 $response_code = 200;
             }
         } else {
             if ($is_admin) {
                 $response_array = array('success' => false, 'error' => 'Owner ID not Found', 'error_code' => 410);
             } else {
                 $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
             }
             $response_code = 200;
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
 public function approvalForm($id)
 {
     $request = Request::find($id);
     //return resource not found if there is no request
     if (!$request) {
         header(' ', true, 404);
         return Redirect::to('request')->with('error', 'Request not found.');
     }
     if ($request->type == 'account') {
         $account = $request->account()->first();
         return View::make('backend/requests/accounts/approve')->with('request', $request)->with('account', $account);
     } elseif ($request->type == 'license' || $request->type == 'checkin') {
         return View::make('backend/requests/license/approve')->with('request', $request);
     }
 }
 public function view_map()
 {
     $id = Request::segment(4);
     $request = Requests::find($id);
     $walker = Walker::find($request->confirmed_walker);
     $owner = Owner::find($request->owner_id);
     if ($request->is_paid) {
         $status = "Payment Done";
     } elseif ($request->is_completed) {
         $status = "Request Completed";
     } elseif ($request->is_started) {
         $status = "Request Started";
     } elseif ($request->is_walker_started) {
         $status = "Provider Started";
     } elseif ($request->confirmed_walker) {
         $status = "Provider Yet to start";
     } else {
         $status = "Provider Not Confirmed";
     }
     if ($request->is_completed) {
         $walk_location_start = WalkLocation::where('request_id', $id)->orderBy('created_at')->first();
         $walk_location_end = WalkLocation::where('request_id', $id)->orderBy('created_at', 'desc')->first();
         $walker_latitude = $walk_location_start->latitude;
         $walker_longitude = $walk_location_start->longitude;
         $owner_latitude = $walk_location_end->latitude;
         $owner_longitude = $walk_location_end->longitude;
     } else {
         if ($request->confirmed_walker) {
             $walker_latitude = $walker->latitude;
             $walker_longitude = $walker->longitude;
         } else {
             $walker_latitude = 0;
             $walker_longitude = 0;
         }
         $owner_latitude = $owner->latitude;
         $owner_longitude = $owner->longitude;
     }
     $request_meta = DB::table('request_meta')->where('request_id', $id)->leftJoin('walker', 'request_meta.walker_id', '=', 'walker.id')->paginate(10);
     if ($request->confirmed_walker) {
         return View::make('walk_map')->with('title', 'Maps')->with('page', 'walks')->with('walk_id', $id)->with('is_started', $request->is_started)->with('owner_name', $owner->first_name . " ", $owner->last_name)->with('walker_name', $walker->first_name . " ", $walker->last_name)->with('walker_latitude', $walker_latitude)->with('walker_longitude', $walker_longitude)->with('owner_latitude', $owner_latitude)->with('owner_longitude', $owner_longitude)->with('walker_phone', $walker->phone)->with('owner_phone', $owner->phone)->with('status', $status)->with('request_meta', $request_meta);
     } else {
         return View::make('walk_map')->with('title', 'Maps')->with('page', 'walks')->with('walk_id', $id)->with('is_started', $request->is_started)->with('owner_name', $owner->first_name . " ", $owner->last_name)->with('walker_name', "")->with('walker_latitude', $walker_latitude)->with('walker_longitude', $walker_longitude)->with('owner_latitude', $owner_latitude)->with('owner_longitude', $owner_longitude)->with('walker_phone', "")->with('owner_phone', $owner->phone)->with('request_meta', $request_meta)->with('status', $status);
     }
 }