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


PHP Walker::find方法代码示例

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


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

示例1: forgot_password

 public function forgot_password()
 {
     $type = Input::get('type');
     $email = Input::get('email');
     if ($type == 1) {
         // Walker
         $walker_data = Walker::where('email', $email)->first();
         if ($walker_data) {
             $walker = Walker::find($walker_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $walker->password = Hash::make($new_password);
             $walker->save();
             // send email
             $settings = Settings::where('key', 'email_forgot_password')->first();
             $pattern = $settings->value;
             $pattern = str_replace('%password%', $new_password, $pattern);
             $subject = "Your New Password";
             email_notification($walker->id, 'walker', $pattern, $subject);
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     } else {
         $owner_data = Owner::where('email', $email)->first();
         if ($owner_data) {
             $owner = Owner::find($owner_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $owner->password = Hash::make($new_password);
             $owner->save();
             $settings = Settings::where('key', 'email_forgot_password')->first();
             $pattern = $settings->value;
             $pattern = str_replace('%password%', $new_password, $pattern);
             $subject = "Your New Password";
             email_notification($owner->id, 'owner', $pattern, $subject);
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:60,代码来源:ApplicationController.php

示例2: send_notifications

function send_notifications($id, $type, $title, $message, $is_imp = NULL)
{
    Log::info('push notification');
    $settings = Settings::where('key', 'push_notification')->first();
    $push_notification = $settings->value;
    if ($type == 'walker') {
        $user = Walker::find($id);
    } else {
        $user = Owner::find($id);
    }
    if ($push_notification == 1 || $is_imp == "imp") {
        if ($user->device_type == 'ios') {
            /* WARNING:- you can't pass devicetoken as string in GCM or IOS push
             * you have to pass array of devicetoken even thow it's only one device's token. */
            /* send_ios_push("E146C7DCCA5EBD49803278B3EE0C1825EF0FA6D6F0B1632A19F783CB02B2617B",$title,$message,$type); */
            send_ios_push($user->device_token, $title, $message, $type);
        } else {
            $message = json_encode($message);
            send_android_push($user->device_token, $title, $message);
        }
    }
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:22,代码来源:helper.php

示例3: userTripDetail

 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";
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:29,代码来源:WebUserController.php

示例4: providerDocuments

 public function providerDocuments()
 {
     $walker_id = Session::get('walker_id');
     $documents = Document::all();
     $walker_document = WalkerDocument::where('walker_id', $walker_id)->get();
     $walker = Walker::find($walker_id);
     $status = 0;
     foreach ($documents as $document) {
         if (!$document) {
             $status = -1;
         } else {
             $status = 0;
         }
     }
     if ($walker->is_approved) {
         $status = 1;
     }
     return View::make('web.providerDocuments')->with('title', 'My Documents')->with('documents', $documents)->with('walker_document', $walker_document)->with('status', $status);
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:19,代码来源:WebProviderController.php

示例5: schedule_request

 public function schedule_request()
 {
     $time = date("Y-m-d H:i:s");
     $query = "SELECT id,owner_id,current_walker,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where status = 0 and is_cancelled = 0";
     $results = DB::select(DB::raw($query));
     foreach ($results as $result) {
         $settings = Settings::where('key', 'provider_timeout')->first();
         $timeout = $settings->value;
         if ($result->diff >= $timeout) {
             // Archiving Old Walker
             RequestMeta::where('request_id', '=', $result->id)->where('walker_id', '=', $result->current_walker)->update(array('status' => 2));
             $request_meta = RequestMeta::where('request_id', '=', $result->id)->where('status', '=', 0)->orderBy('created_at')->first();
             // update request
             if (isset($request_meta->walker_id)) {
                 // assign new walker
                 Requests::where('id', '=', $result->id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s")));
                 // Send Notification
                 $walker = Walker::find($request_meta->walker_id);
                 $owner_data = Owner::find($result->owner_id);
                 $msg_array = array();
                 $msg_array['request_id'] = $result->id;
                 $msg_array['id'] = $request_meta->walker_id;
                 if ($walker) {
                     $msg_array['token'] = $walker->token;
                 }
                 $msg_array['client_profile'] = array();
                 $msg_array['client_profile']['name'] = $owner_data->first_name . " " . $owner_data->last_name;
                 $msg_array['client_profile']['picture'] = $owner_data->picture;
                 $msg_array['client_profile']['bio'] = $owner_data->bio;
                 $msg_array['client_profile']['address'] = $owner_data->address;
                 $msg_array['client_profile']['phone'] = $owner_data->phone;
                 $title = "New Request";
                 $message = $msg_array;
                 send_notifications($request_meta->walker_id, "walker", $title, $message);
             } else {
                 // request ended
                 Requests::where('id', '=', $result->id)->update(array('current_walker' => 0, 'status' => 1));
                 $settings = Settings::where('key', 'sms_request_unanswered')->first();
                 $pattern = $settings->value;
                 $pattern = str_replace('%id%', $result->id, $pattern);
                 sms_notification(1, 'admin', $pattern);
                 // send email
                 $settings = Settings::where('key', 'email_request_unanswered')->first();
                 $pattern = $settings->value;
                 $pattern = str_replace('%id%', $result->id, $pattern);
                 $pattern = str_replace('%url%', web_url() . "/admin/request/map/" . $result->id, $pattern);
                 $subject = "New Request Unansweres";
                 email_notification(1, 'admin', $pattern, $subject);
             }
         }
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:52,代码来源:DogController.php

示例6: alternative_walkers_xml

 public function alternative_walkers_xml()
 {
     $id = Request::segment(4);
     $walk = Walk::find($id);
     $schedule = Schedules::find($walk->schedule_id);
     $dog = Dog::find($walk->dog_id);
     $owner = Owner::find($dog->owner_id);
     $current_walker = Walker::find($walk->walker_id);
     $latitude = $owner->latitude;
     $longitude = $owner->longitude;
     $distance = 5;
     // Get Latitude
     $schedule_meta = ScheduleMeta::where('schedule_id', '=', $schedule->id)->orderBy('started_on', 'DESC')->get();
     $flag = 0;
     $date = "0000-00-00";
     $days = array();
     foreach ($schedule_meta as $meta) {
         if ($flag == 0) {
             $date = $meta->started_on;
             $flag++;
         }
         array_push($days, $meta->day);
     }
     $start_time = date('H:i:s', strtotime($schedule->start_time) - 60 * 60);
     $end_time = date('H:i:s', strtotime($schedule->end_time) + 60 * 60);
     $days_str = implode(',', $days);
     $settings = Settings::where('key', 'default_distance_unit')->first();
     $unit = $settings->value;
     if ($unit == 0) {
         $multiply = 1.609344;
     } elseif ($unit == 1) {
         $multiply = 1;
     }
     $query = "SELECT walker.id,walker.bio,walker.first_name,walker.last_name,walker.phone,walker.latitude,walker.longitude from walker where id NOT IN ( SELECT distinct schedules.walker_id FROM `schedule_meta` left join schedules on schedule_meta.schedule_id = schedules.id where schedules.is_confirmed\t != 0 and schedule_meta.day IN ({$days_str}) and schedule_meta.ends_on >= '{$date}' and schedule_meta.started_on <= '{$date}' and ((schedules.start_time > '{$start_time}' and schedules.start_time < '{$end_time}') OR ( schedules.end_time > '{$start_time}' and schedules.end_time < '{$end_time}' )) ) and " . "ROUND((" . $multiply . " * 3956 * acos( cos( radians('{$latitude}') ) * " . "cos( radians(latitude) ) * " . "cos( radians(longitude) - radians('{$longitude}') ) + " . "sin( radians('{$latitude}') ) * " . "sin( radians(latitude) ) ) ) ,8) <= {$distance} ";
     $walkers = DB::select(DB::raw($query));
     $response = "";
     $response .= '<markers>';
     foreach ($walkers as $walker) {
         $response .= '<marker ';
         $response .= 'name="' . $walker->first_name . " " . $walker->last_name . '" ';
         $response .= 'client_name="' . $walker->first_name . " " . $walker->last_name . '" ';
         $response .= 'contact="' . $walker->phone . '" ';
         $response .= 'amount="' . 0 . '" ';
         $response .= 'lat="' . $walker->latitude . '" ';
         $response .= 'lng="' . $walker->longitude . '" ';
         $response .= 'id="' . $walker->id . '" ';
         $response .= 'type="client" ';
         $response .= '/>';
     }
     // Add Current walker
     if ($current_walker) {
         $response .= '<marker ';
         $response .= 'name="' . $current_walker->first_name . " " . $current_walker->last_name . '" ';
         $response .= 'client_name="' . $current_walker->first_name . " " . $current_walker->last_name . '" ';
         $response .= 'contact="' . $current_walker->phone . '" ';
         $response .= 'amount="' . 0 . '" ';
         $response .= 'lat="' . $current_walker->latitude . '" ';
         $response .= 'lng="' . $current_walker->longitude . '" ';
         $response .= 'id="' . $current_walker->id . '" ';
         $response .= 'type="driver" ';
         $response .= '/>';
     }
     // Add Owner
     $response .= '<marker ';
     $response .= 'name="' . $owner->first_name . " " . $owner->last_name . '" ';
     $response .= 'client_name="' . $owner->first_name . " " . $owner->last_name . '" ';
     $response .= 'contact="' . $owner->phone . '" ';
     $response .= 'amount="' . 0 . '" ';
     $response .= 'lat="' . $owner->latitude . '" ';
     $response .= 'lng="' . $owner->longitude . '" ';
     $response .= 'id="' . $owner->id . '" ';
     $response .= 'type="client_pay_done" ';
     $response .= '/>';
     // Add Busy Walkers
     $walkers = DB::table('request')->where('walk.is_started', 1)->where('walk.is_completed', 0)->join('walker', 'walk.walker_id', '=', 'walker.id')->select('walker.id', 'walker.phone', 'walker.first_name', 'walker.last_name', 'walker.latitude', 'walker.longitude')->distinct()->get();
     foreach ($walkers as $walker) {
         $response .= '<marker ';
         $response .= 'name="' . $walker->first_name . " " . $walker->last_name . '" ';
         $response .= 'client_name="' . $walker->first_name . " " . $walker->last_name . '" ';
         $response .= 'contact="' . $walker->phone . '" ';
         $response .= 'amount="' . 0 . '" ';
         $response .= 'lat="' . $walker->latitude . '" ';
         $response .= 'lng="' . $walker->longitude . '" ';
         $response .= 'id="' . $owner->id . '" ';
         $response .= 'type="client_no_pay" ';
         $response .= '/>';
     }
     $response .= '</markers>';
     $content = View::make('walkers_xml')->with('response', $response);
     return Response::make($content, '200')->header('Content-Type', 'text/xml');
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:91,代码来源:AdminController.php

示例7: update_profile

 public function update_profile()
 {
     $token = Input::get('token');
     $walker_id = Input::get('id');
     $first_name = Input::get('first_name');
     $last_name = Input::get('last_name');
     $email = Input::get('email');
     $phone = Input::get('phone');
     $password = Input::get('password');
     $picture = Input::file('picture');
     $bio = Input::get('bio');
     $address = Input::get('address');
     $state = Input::get('state');
     $country = Input::get('country');
     $zipcode = Input::get('zipcode');
     $validator = Validator::make(array('token' => $token, 'walker_id' => $walker_id, 'email' => $email, 'picture' => $picture, 'zipcode' => $zipcode), array('token' => 'required', 'walker_id' => 'required|integer', 'email' => 'email', 'picture' => 'mimes:jpeg,bmp,png', 'zipcode' => '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 ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
             // check for token validity
             if (is_token_active($walker_data->token_expiry) || $is_admin) {
                 $walker = Walker::find($walker_id);
                 if ($first_name) {
                     $walker->first_name = $first_name;
                 }
                 if ($last_name) {
                     $walker->last_name = $last_name;
                 }
                 if ($email) {
                     $walker->email = $email;
                 }
                 if ($phone) {
                     $walker->phone = $phone;
                 }
                 if ($bio) {
                     $walker->bio = $bio;
                 }
                 if ($address) {
                     $walker->address = $address;
                 }
                 if ($state) {
                     $walker->state = $state;
                 }
                 if ($country) {
                     $walker->country = $country;
                 }
                 if ($zipcode) {
                     $walker->zipcode = $zipcode;
                 }
                 if ($password) {
                     $walker->password = Hash::make($password);
                 }
                 if (Input::hasFile('picture')) {
                     // upload image
                     $file_name = time();
                     $file_name .= rand();
                     $file_name = sha1($file_name);
                     $ext = Input::file('picture')->getClientOriginalExtension();
                     Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
                     $local_url = $file_name . "." . $ext;
                     // Upload to S3
                     if (Config::get('app.s3_bucket') != "") {
                         $s3 = App::make('aws')->get('s3');
                         $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/uploads/" . $local_url));
                         $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read'));
                         $s3_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name);
                     } else {
                         $s3_url = asset_url() . '/uploads/' . $local_url;
                     }
                     $walker->picture = $s3_url;
                 }
                 $walker->save();
                 $response_array = array('success' => true, 'id' => $walker->id, 'first_name' => $walker->first_name, 'last_name' => $walker->last_name, 'phone' => $walker->phone, 'email' => $walker->email, 'picture' => $walker->picture, 'bio' => $walker->bio, 'address' => $walker->address, 'state' => $walker->state, 'country' => $walker->country, 'zipcode' => $walker->zipcode, 'login_by' => $walker->login_by, 'social_unique_id' => $walker->social_unique_id, 'device_token' => $walker->device_token, 'device_type' => $walker->device_type, 'token' => $walker->token, 'type' => $walker->type);
                 $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;
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:94,代码来源:WalkerController.php

示例8: update_profile

 public function update_profile()
 {
     $token = Input::get('token');
     $walker_id = Input::get('id');
     $first_name = Input::get('first_name');
     $last_name = Input::get('last_name');
     $phone = Input::get('phone');
     $password = Input::get('password');
     $new_password = Input::get('new_password');
     $old_password = Input::get('old_password');
     $picture = Input::file('picture');
     $bio = Input::get('bio');
     $address = Input::get('address');
     $state = Input::get('state');
     $country = Input::get('country');
     $zipcode = Input::get('zipcode');
     /* $car_model = $car_number = "";
        if (Input::has('car_model')) {
            $car_model = trim(Input::get('car_model'));
        }
        if (Input::has('car_number')) {
            $car_number = trim(Input::get('car_number'));
        }*/
     $validator = Validator::make(array('token' => $token, 'walker_id' => $walker_id, 'picture' => $picture, 'zipcode' => $zipcode), array('token' => 'required', 'walker_id' => 'required|integer', 'picture' => '', 'zipcode' => '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 ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
             // check for token validity
             if (is_token_active($walker_data->token_expiry) || $is_admin) {
                 if (Input::get('new_password')) {
                     if (Input::get('old_password') != "") {
                         if (Hash::check($old_password, $walker_data->password)) {
                             $walker = Walker::find($walker_id);
                             if ($first_name) {
                                 $walker->first_name = $first_name;
                             }
                             if ($last_name) {
                                 $walker->last_name = $last_name;
                             }
                             if ($phone) {
                                 $walker->phone = $phone;
                             }
                             if ($bio) {
                                 $walker->bio = $bio;
                             }
                             if ($address) {
                                 $walker->address = $address;
                             }
                             if ($state) {
                                 $walker->state = $state;
                             }
                             if ($country) {
                                 $walker->country = $country;
                             }
                             if ($zipcode) {
                                 $walker->zipcode = $zipcode;
                             }
                             if ($password) {
                                 $walker->password = Hash::make($new_password);
                             }
                             /*  if ($car_model != "") {
                                     $walker->car_model;
                                 }
                                 if ($car_number != "") {
                                     $walker->car_number;
                                 }*/
                             if (Input::hasFile('picture')) {
                                 if ($walker->picture != "") {
                                     $path = $walker->picture;
                                     Log::info($path);
                                     $filename = basename($path);
                                     Log::info($filename);
                                     if (file_exists($path)) {
                                         unlink(public_path() . "/uploads/" . $filename);
                                     }
                                 }
                                 // upload image
                                 $file_name = time();
                                 $file_name .= rand();
                                 $file_name = sha1($file_name);
                                 $ext = Input::file('picture')->getClientOriginalExtension();
                                 Log::info('ext = ' . print_r($ext, true));
                                 Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
                                 $local_url = $file_name . "." . $ext;
                                 // Upload to S3
                                 if (Config::get('app.s3_bucket') != "") {
                                     $s3 = App::make('aws')->get('s3');
                                     $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/uploads/" . $local_url));
                                     $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read'));
                                     $s3_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name);
                                 } else {
                                     $s3_url = asset_url() . '/uploads/' . $local_url;
                                 }
                                 if (isset($walker->picture)) {
                                     if ($walker->picture != "") {
                                         $icon = $walker->picture;
//.........这里部分代码省略.........
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:WalkerController.php

示例9: eta

 public function eta()
 {
     $secret = Input::get('secret');
     $token = Input::get('token');
     $owner_id = Input::get('id');
     $validator = Validator::make(array('secret' => $secret, 'token' => $token, 'owner_id' => $owner_id), array('secret' => '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
                 $request = Requests::where('security_key', $secret)->first();
                 if ($request) {
                     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 = WalkLocation::where('request_id', $request->id)->max('distance');
                     }
                     $settings = Settings::where('key', 'default_distance_unit')->first();
                     $unit = $settings->value;
                     if ($unit == 0) {
                         $unit_set = 'kms';
                     } elseif ($unit == 1) {
                         $unit_set = 'miles';
                     }
                     $distance = convert($distance, $unit);
                     $response_array = array('success' => true, 'latitude' => $walker->latitude, 'longitude' => $walker->longitude, 'destination_latitude' => $request->D_latitude, 'destination longitude' => $request->D_longitude, 'distance' => (string) $distance, 'unit' => $unit_set);
                     $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) {
                 /* $var = Keywords::where('id', 2)->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.User') . ' 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;
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:57,代码来源:DogController.php

示例10: forgot_password

 public function forgot_password()
 {
     $type = Input::get('type');
     $email = Input::get('email');
     if ($type == 1) {
         // Walker
         $walker_data = Walker::where('email', $email)->first();
         if ($walker_data) {
             $walker = Walker::find($walker_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $walker->password = Hash::make($new_password);
             $walker->save();
             /* $subject = "Your New Password";
                $email_data = array();
                $email_data['password'] = $new_password;
                send_email($walker->id, 'walker', $email_data, $subject, 'forgotpassword'); */
             $settings = Settings::where('key', 'admin_email_address')->first();
             $admin_email = $settings->value;
             $login_url = web_url() . "/provider/signin";
             $pattern = array('name' => $walker->first_name . " " . $walker->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
             $subject = "Your New Password";
             email_notification($walker->id, 'walker', $pattern, $subject, 'forgot_password', "imp");
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     } else {
         $owner_data = Owner::where('email', $email)->first();
         if ($owner_data) {
             $owner = Owner::find($owner_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $owner->password = Hash::make($new_password);
             $owner->save();
             /* $subject = "Your New Password";
                $email_data = array();
                $email_data['password'] = $new_password;
                send_email($owner->id, 'owner', $email_data, $subject, 'forgotpassword'); */
             $settings = Settings::where('key', 'admin_email_address')->first();
             $admin_email = $settings->value;
             $login_url = web_url() . "/user/signin";
             $pattern = array('name' => $owner->first_name . " " . $owner->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
             $subject = "Your New Password";
             email_notification($owner->id, 'owner', $pattern, $subject, 'forgot_password', "imp");
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:69,代码来源:ApplicationController.php

示例11: providerDocuments

 public function providerDocuments()
 {
     $walker_id = Session::get('walker_id');
     $documents = DB::table('documents')->leftJoin('walker_documents', 'documents.id', '=', 'walker_documents.document_id')->select('name', 'url', 'documents.id')->get();
     $walker = Walker::find($walker_id);
     $status = 0;
     foreach ($documents as $document) {
         if (!$document->url) {
             $status = -1;
         }
     }
     if ($walker->is_approved) {
         $status = 1;
     }
     return View::make('web.providerDocuments')->with('title', 'My Documents')->with('documents', $documents)->with('status', $status);
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:16,代码来源:WebProviderController.php


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