@@ -20,8 +20,8 @@ class Builder extends EloquentBuilder
20
20
/**
21
21
* Update a record in the database.
22
22
*
23
- * @param array $values
24
- * @param array $options
23
+ * @param array $values
24
+ * @param array $options
25
25
* @return int
26
26
*/
27
27
public function update (array $ values , array $ options = [])
@@ -40,7 +40,7 @@ public function update(array $values, array $options = [])
40
40
/**
41
41
* Insert a new record into the database.
42
42
*
43
- * @param array $values
43
+ * @param array $values
44
44
* @return bool
45
45
*/
46
46
public function insert (array $ values )
@@ -59,8 +59,8 @@ public function insert(array $values)
59
59
/**
60
60
* Insert a new record and get the value of the primary key.
61
61
*
62
- * @param array $values
63
- * @param string $sequence
62
+ * @param array $values
63
+ * @param string $sequence
64
64
* @return int
65
65
*/
66
66
public function insertGetId (array $ values , $ sequence = null )
@@ -97,9 +97,9 @@ public function delete()
97
97
/**
98
98
* Increment a column's value by a given amount.
99
99
*
100
- * @param string $column
101
- * @param int $amount
102
- * @param array $extra
100
+ * @param string $column
101
+ * @param int $amount
102
+ * @param array $extra
103
103
* @return int
104
104
*/
105
105
public function increment ($ column , $ amount = 1 , array $ extra = [])
@@ -127,9 +127,9 @@ public function increment($column, $amount = 1, array $extra = [])
127
127
/**
128
128
* Decrement a column's value by a given amount.
129
129
*
130
- * @param string $column
131
- * @param int $amount
132
- * @param array $extra
130
+ * @param string $column
131
+ * @param int $amount
132
+ * @param array $extra
133
133
* @return int
134
134
*/
135
135
public function decrement ($ column , $ amount = 1 , array $ extra = [])
@@ -155,11 +155,11 @@ public function decrement($column, $amount = 1, array $extra = [])
155
155
/**
156
156
* Add the "has" condition where clause to the query.
157
157
*
158
- * @param \Illuminate\Database\Eloquent\Builder $hasQuery
159
- * @param \Illuminate\Database\Eloquent\Relations\Relation $relation
160
- * @param string $operator
161
- * @param int $count
162
- * @param string $boolean
158
+ * @param \Illuminate\Database\Eloquent\Builder $hasQuery
159
+ * @param \Illuminate\Database\Eloquent\Relations\Relation $relation
160
+ * @param string $operator
161
+ * @param int $count
162
+ * @param string $boolean
163
163
* @return \Illuminate\Database\Eloquent\Builder
164
164
*/
165
165
protected function addHasWhere (EloquentBuilder $ hasQuery , Relation $ relation , $ operator , $ count , $ boolean )
@@ -168,7 +168,7 @@ protected function addHasWhere(EloquentBuilder $hasQuery, Relation $relation, $o
168
168
169
169
// Get the number of related objects for each possible parent.
170
170
$ relationCount = array_count_values (array_map (function ($ id ) {
171
- return (string ) $ id ; // Convert Back ObjectIds to Strings
171
+ return (string )$ id ; // Convert Back ObjectIds to Strings
172
172
}, $ query ->pluck ($ relation ->getHasCompareKey ())));
173
173
174
174
// Remove unwanted related objects based on the operator and count.
@@ -209,7 +209,7 @@ protected function addHasWhere(EloquentBuilder $hasQuery, Relation $relation, $o
209
209
/**
210
210
* Create a raw database expression.
211
211
*
212
- * @param closure $expression
212
+ * @param closure $expression
213
213
* @return mixed
214
214
*/
215
215
public function raw ($ expression = null )
@@ -221,13 +221,17 @@ public function raw($expression = null)
221
221
if ($ results instanceof Cursor) {
222
222
$ results = iterator_to_array ($ results , false );
223
223
return $ this ->model ->hydrate ($ results );
224
- } // Convert Mongo BSONDocument to a single object.
224
+ }
225
+
226
+ // Convert Mongo BSONDocument to a single object.
225
227
elseif ($ results instanceof BSONDocument) {
226
228
$ results = $ results ->getArrayCopy ();
227
- return $ this ->model ->newFromBuilder ((array ) $ results );
228
- } // The result is a single object.
229
+ return $ this ->model ->newFromBuilder ((array )$ results );
230
+ }
231
+
232
+ // The result is a single object.
229
233
elseif (is_array ($ results ) and array_key_exists ('_id ' , $ results )) {
230
- return $ this ->model ->newFromBuilder ((array ) $ results );
234
+ return $ this ->model ->newFromBuilder ((array )$ results );
231
235
}
232
236
233
237
return $ results ;
0 commit comments