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

Commit

Permalink
fix failing tests as config function does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbarrettjb committed Jun 8, 2018
1 parent ead7ad1 commit bab919c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getPostgisFields()
protected function asWKT(GeometryInterface $geometry)
{
return $this->getQuery()->raw(
sprintf("%s.ST_GeogFromText('%s')", config('postgis.schema'), $geometry->toWKT())
sprintf("%s.ST_GeogFromText('%s')", function_exists('config') ? config('postgis.schema') : 'public', $geometry->toWKT())
);

}
Expand Down
6 changes: 3 additions & 3 deletions src/Eloquent/PostgisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ protected function performInsert(EloquentBuilder $query, array $options = [])
case 'GEOMETRY':
$this->attributes[$key] = $this->getConnection()->raw(
sprintf("%s.ST_GeomFromText('%s', '%d')",
config('postgis.schema'), $value->toWKT(), $attrs['srid'])
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT(), $attrs['srid'])
);
break;
case 'GEOGRAPHY':
default:
$this->attributes[$key] = $this->getConnection()->raw(
sprintf("%s.ST_GeogFromText('%s')",
config('postgis.schema'), $value->toWKT())
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT())
);
break;
}
} else {
$this->attributes[$key] = $this->getConnection()->raw(
sprintf("%s.ST_GeomFromText('%s', 4326)",
config('postgis.schema'), $value->toWKT())
function_exists('config') ? config('postgis.schema') : 'public', $value->toWKT())
);
}
}
Expand Down

0 comments on commit bab919c

Please sign in to comment.