我在public_html/app文件夹中的共享主机上部署了laravel app.这是公共文件夹中的所有内容.在/../../files我有其余的文件.当我做php artisan存储:我的控制台说文件夹中的链接
[ErrorException]
symlink(): No such file or directory
Run Code Online (Sandbox Code Playgroud)
在localhost上,我将文件上传到storage/uploads文件夹.现在做什么?我试图改变链接,但没有什么对我有用......
我想使用给定的距离过滤我的数据库中的用户.
在数据库中,我有城市,经度和纬度.现在我们应该在城市和距离该城市的距离写作,脚本应该返回给定公里内该城市附近的所有用户.
我怎样才能做到这一点?
这是我的代码:
if ($request->has('city')) {
$from_latitude = app('geocoder')->geocode($data['residence'])->get()->first()->getCoordinates()->getLatitude();
$from_longitude = app('geocoder')->geocode($data['residence'])->get()->first()->getCoordinates()->getLongitude();
$user->whereHas('user_data', function($query) use ($request) {
$raw = \DB::raw('ROUND ( ( 6371 * acos( cos( radians('.$from_latitude.') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('.$from_longitude.') ) + sin( radians('.$from_latitude.') ) * sin( radians( latitude ) ) ) ) ) AS distance');
return $query->select('*')->addSelect($raw)->orderBy( 'distance', 'ASC' )->groupBy('distance')->having('distance', '<=', $distance);
});
}
Run Code Online (Sandbox Code Playgroud)