Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
esyede authored Jul 7, 2023
1 parent 46f1726 commit 174c4ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion system/database/facile/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public function paginate($perpage = null, array $columns = ['*'])
$perpage = $perpage ?: $this->model->perpage();
$paginator = $this->table->paginate($perpage, $columns);
$paginator->results = $this->hydrate($this->model, $paginator->results);
$paginator->results = array_map(function ($result) {
return (($result instanceof Model) && property_exists($result, 'attributes'))
? (object) $result->attributes
: $result;
}, $paginator->results);

return $paginator;
}
Expand All @@ -128,7 +133,7 @@ public function hydrate($model, array $results)
foreach ($results as $result) {
$model = new $model([], true);
$model->fill_raw((array) $result);
$models[] = (object) $model->attributes;
$models[] = $model;
}

if (count($results) > 0) {
Expand Down

0 comments on commit 174c4ba

Please sign in to comment.