create history for webservice
This commit is contained in:
@@ -86,23 +86,18 @@ class City extends Model
|
||||
{
|
||||
try {
|
||||
$city = City::query()
|
||||
->whereRaw("
|
||||
ST_Contains(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)
|
||||
)
|
||||
")
|
||||
->firstOrFail();
|
||||
}
|
||||
catch (ModelNotFoundException $exception) {
|
||||
->whereRaw("ST_Contains(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326))"
|
||||
)
|
||||
->firstOrFail(['id', 'name_fa', 'province_id']);
|
||||
} catch (ModelNotFoundException $exception) {
|
||||
$city = City::query()
|
||||
->orderByRaw("
|
||||
ST_Distance(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)
|
||||
) ASC
|
||||
")
|
||||
->first();
|
||||
->orderByRaw("ST_Distance(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)) ASC"
|
||||
)
|
||||
->first(['id', 'name_fa', 'province_id']);
|
||||
}
|
||||
|
||||
return $city;
|
||||
|
||||
Reference in New Issue
Block a user