Как я могу рассчитать расстояние в laravel5.5 с помощью SQL-запроса?Мой код упоминается ниже.
$specialProducts = Products::select('products.id', 'products.name', 'products.product_img', 'products.slug', 'products.price','products.lat','(3959 * ACOS(COS(RADIANS($lat))* COS(RADIANS(22.2765097))* COS(RADIANS(70.792523) - RADIANS(70.7583265))+ SIN(RADIANS(22.2897874))* SIN(RADIANS(22.2765097)))) AS distance')
->join('subcategories', 'subcategories.id', '=', 'products.sub_category_id')
->join('categories', 'categories.id', '=', 'subcategories.category_id')
->join('store', 'store.id', '=', 'products.store_id')
->where('products.status', 1)
->where('products.special', 1)
->orderBy('products.created_at', 'DESC')
->get();