diff --git a/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/src/Illuminate/Database/Query/Processors/PostgresProcessor.php index ab350cb058ce..bbdfa95c313d 100755 --- a/src/Illuminate/Database/Query/Processors/PostgresProcessor.php +++ b/src/Illuminate/Database/Query/Processors/PostgresProcessor.php @@ -17,14 +17,12 @@ class PostgresProcessor extends Processor */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { - $results = $query->getConnection()->selectFromWriteConnection($sql, $values); + $result = $query->getConnection()->selectFromWriteConnection($sql, $values)[0]; $sequence = $sequence ?: 'id'; - $result = (array) $results[0]; - - $id = $result[$sequence]; - + $id = is_object($result) ? $result->$sequence : $result[$sequence]; + return is_numeric($id) ? (int) $id : $id; }