當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Walker::whereIn方法代碼示例

本文整理匯總了PHP中Walker::whereIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Walker::whereIn方法的具體用法?PHP Walker::whereIn怎麽用?PHP Walker::whereIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Walker的用法示例。


在下文中一共展示了Walker::whereIn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_providers


//.........這裏部分代碼省略.........
                         foreach ($type1 as $key) {
                             $type[] = (int) $key;
                         }
                         Log::info('type = ' . print_r($type, true));
                         $count = count($type);
                     }
                     if (!$type) {
                         // choose default type
                         $provider_type = ProviderType::where('is_default', 1)->first();
                         if (!$provider_type) {
                             $type = 1;
                         } else {
                             $type = $provider_type->id;
                         }
                     }
                     $settings = Settings::where('key', 'default_search_radius')->first();
                     $distance = $settings->value;
                     $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.first_name, " . "walker.last_name, " . "walker.picture, " . "walker.phone, " . "walker.latitude, " . "walker.longitude, " . "ROUND(" . $multiply . " * 3956 * acos( cos( radians('{$latitude}') ) * " . "cos( radians(latitude) ) * " . "cos( radians(longitude) - radians('{$longitude}') ) + " . "sin( radians('{$latitude}') ) * " . "sin( radians(latitude) ) ) ,8) as distance " . "from walker " . "where is_available = 1 and " . "is_active = 1 and " . "is_approved = 1 and " . "ROUND((" . $multiply . " * 3956 * acos( cos( radians('{$latitude}') ) * " . "cos( radians(latitude) ) * " . "cos( radians(longitude) - radians('{$longitude}') ) + " . "sin( radians('{$latitude}') ) * " . "sin( radians(latitude) ) ) ) ,8) <= {$distance} " . "order by distance " . "LIMIT 5";
                     $walker = DB::select(DB::raw($query));
                     $typewalker = array();
                     $typewalker1 = array();
                     foreach ($walker as $key) {
                         $typewalker[] = $key->id;
                     }
                     $flag = 0;
                     if ($typewalker) {
                         $walkers = ProviderServices::whereIn('provider_id', $typewalker)->whereIn('type', $type)->groupBy('provider_id')->havingRaw('count(distinct type) = ' . $count)->get();
                         foreach ($walkers as $key) {
                             $typewalker1[] = $key->provider_id;
                         }
                         if ($typewalker1) {
                             $walkers = Walker::whereIn('id', $typewalker1)->get();
                             if ($walkers) {
                                 $flag = 1;
                             }
                         }
                     }
                     if ($flag == 1) {
                         $c = 0;
                         foreach ($walkers as $key) {
                             $provider[$c]['id'] = $key->id;
                             $provider[$c]['first_name'] = $key->first_name;
                             $provider[$c]['last_name'] = $key->last_name;
                             $provider[$c]['picture'] = $key->picture;
                             $provider[$c]['phone'] = $key->phone;
                             $provider[$c]['latitude'] = $key->latitude;
                             $provider[$c]['longitude'] = $key->longitude;
                             $provider[$c]['rating'] = $key->rate;
                             $provider[$c]['car_model'] = $key->car_model;
                             $provider[$c]['car_number'] = $key->car_number;
                             $provider[$c]['bearing'] = $key->bearing;
                             $provserv = ProviderServices::where('provider_id', $key->id)->get();
                             foreach ($provserv as $ps) {
                                 $provider[$c]['type'] = $ps->type;
                                 $provider[$c]['base_price'] = $ps->base_price;
                             }
                             /* $rat = WalkerReview::where('walker_id', $key->id)->get();
                                                               $countRating = count($rat);
                             
開發者ID:felipemarques8,項目名稱:goentregas,代碼行數:66,代碼來源:DogController.php


注:本文中的Walker::whereIn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。