当前位置: 首页>>代码示例>>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;未经允许,请勿转载。