For some reason, using ST_Intersects in Laravel gives error:
Undefined function: 7 ERROR: function st_intersects(public.geometry, public.geometry) does not exist
Exactly same query, with same DB is working perfectly fine in plain PHP.
Full query text:
$query =
"SELECT estado, municipio, COUNT(*)
FROM public.focos_bdq, dados_geo.poligonos_deter
WHERE ST_Intersects(focos_bdq.geometria, poligonos_deter.geom)
AND bioma LIKE '$bioma_bd'
AND date_trunc('month', data_hora_gmt)::date = '$mes_anterior'
AND (satelite LIKE 'AQUA%' OR satelite LIKE 'TERRA%')
GROUP BY municipio, estado
ORDER BY COUNT(*) DESC";
$focos = \DB::select($query);
Perhaps you should append the schema name (postgis) to the function name. postgis.ST_Intersects(...
Alternatively the user that laravel logs in with might need to have its schema search path set properly.