Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit bab919c

Browse files
committed
fix failing tests as config function does not exist
1 parent ead7ad1 commit bab919c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function getPostgisFields()
2525
protected function asWKT(GeometryInterface $geometry)
2626
{
2727
return $this->getQuery()->raw(
28-
sprintf("%s.ST_GeogFromText('%s')", config('postgis.schema'), $geometry->toWKT())
28+
sprintf("%s.ST_GeogFromText('%s')", function_exists('config') ? config('postgis.schema') : 'public', $geometry->toWKT())
2929
);
3030

3131
}

src/Eloquent/PostgisTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ protected function performInsert(EloquentBuilder $query, array $options = [])
3535
case 'GEOMETRY':
3636
$this->attributes[$key] = $this->getConnection()->raw(
3737
sprintf("%s.ST_GeomFromText('%s', '%d')",
38-
config('postgis.schema'), $value->toWKT(), $attrs['srid'])
38+
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT(), $attrs['srid'])
3939
);
4040
break;
4141
case 'GEOGRAPHY':
4242
default:
4343
$this->attributes[$key] = $this->getConnection()->raw(
4444
sprintf("%s.ST_GeogFromText('%s')",
45-
config('postgis.schema'), $value->toWKT())
45+
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT())
4646
);
4747
break;
4848
}
4949
} else {
5050
$this->attributes[$key] = $this->getConnection()->raw(
5151
sprintf("%s.ST_GeomFromText('%s', 4326)",
52-
config('postgis.schema'), $value->toWKT())
52+
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT())
5353
);
5454
}
5555
}

0 commit comments

Comments
 (0)