我有一个简单的问题,我找不到我需要的东西.
我需要计算商店列表的t2地理编码点之间的距离.我还需要将它分页为WebService.
这有效,但结果中没有距离:
public function stores(){
return Store::paginate(10);
}
Run Code Online (Sandbox Code Playgroud)
结果是:
{
total: 4661,
per_page: 10,
current_page: 6,
last_page: 467,
next_page_url: "WS_URL/stores/?page=7",
prev_page_url: "WS_URL/stores/?page=5", from: 51,
to: 60,
data: [ {
id: "51",
name: "Sprouts",
.
.
lng: "-118.359688",
lat: "33.808281",
country: "usa"
},
.
.
.
]}
Run Code Online (Sandbox Code Playgroud)
但我需要这个代码工作:
public function stores(){
return DB::table('stores')
->selectRaw(' *, distance(lat, ?, lng, ?) as distance ')
->setBindings([ 41.123401,1.2409893])
->orderBy('distance')
->paginate($this->limit);
}
Run Code Online (Sandbox Code Playgroud)
这就是结果:
{total: 0,
per_page: 10,
current_page: 1,
last_page: 0,
next_page_url: null,
prev_page_url: null, …Run Code Online (Sandbox Code Playgroud) 我有一个简单的问题:
我无法强制[UIApplication sharedApplication] openUrl: 打开网页导航器中的网址,始终打开Facebook应用程序,不要去facebook页面.