Commit ab5b3844 authored by pi0's avatar pi0

Reformat and FIX

parent b0e2a184
......@@ -168,7 +168,7 @@ class Builder extends EloquentBuilder
// Get the number of related objects for each possible parent.
$relationCount = array_count_values(array_map(function ($id) {
return (string) $id; // Convert Back ObjectIds to Strings
return (string)$id; // Convert Back ObjectIds to Strings
}, $query->pluck($relation->getHasCompareKey())));
// Remove unwanted related objects based on the operator and count.
......@@ -221,13 +221,17 @@ class Builder extends EloquentBuilder
if ($results instanceof Cursor) {
$results = iterator_to_array($results, false);
return $this->model->hydrate($results);
} // Convert Mongo BSONDocument to a single object.
}
// Convert Mongo BSONDocument to a single object.
elseif ($results instanceof BSONDocument) {
$results = $results->getArrayCopy();
return $this->model->newFromBuilder((array) $results);
} // The result is a single object.
return $this->model->newFromBuilder((array)$results);
}
// The result is a single object.
elseif (is_array($results) and array_key_exists('_id', $results)) {
return $this->model->newFromBuilder((array) $results);
return $this->model->newFromBuilder((array)$results);
}
return $results;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment