HEX
Server: LiteSpeed
System: Linux server334.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: richfield (1256)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /home/richfield/www/vendor/tcg/voyager/src/Http/Controllers/ContentTypes/Coordinates.php
<?php

namespace TCG\Voyager\Http\Controllers\ContentTypes;

use Illuminate\Support\Facades\DB;

class Coordinates extends BaseType
{
    /**
     * @return string|\Illuminate\Database\Query\Expression
     */
    public function handle()
    {
        if (empty($coordinates = $this->request->input($this->row->field))) {
            return;
        }
        //DB::connection()->getPdo()->quote won't work as it quotes the
        // lat/lng, which leads to wrong Geometry type in POINT() MySQL constructor
        $lat = (float) $coordinates['lat'];
        $lng = (float) $coordinates['lng'];

        return DB::raw("ST_GeomFromText('POINT({$lng} {$lat})')");
    }
}