Skip to content

Commit 6ca4f41

Browse files
committed
Merge branch 'main' into dev
2 parents dad1384 + 55b1668 commit 6ca4f41

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
## [0.12.2] - 2025-04-25
10+
11+
### Fixed
12+
13+
- Fix empty data.
14+
915
## [0.12.1] - 2025-04-25
1016

1117
### Fixed
@@ -303,6 +309,7 @@ _Stable release based on [0.1.0-rc.1]._
303309
- New changelog file.
304310

305311
[Unreleased]: https://https://github.com/internetguru/laravel-model-browser/compare/staging...dev
312+
[0.12.2]: https://https://github.com/internetguru/laravel-model-browser/compare/v0.12.1...v0.12.2
306313
[0.12.1]: https://https://github.com/internetguru/laravel-model-browser/compare/v0.12.0...v0.12.1
307314
[0.12.0]: https://https://github.com/internetguru/laravel-model-browser/compare/v0.11.0...v0.12.0
308315
[0.12.0-rc.1]: https://github.com/internetguru/laravel-model-browser/releases/tag/v0.11.0

src/Components/BaseModelBrowser.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,17 @@ protected function getData(bool $paginate = true, bool $highlightMatches = true,
166166
? $this->model::{$this->modelMethod}()
167167
: $this->model::query()->get();
168168

169+
if ($data->count() === 0) {
170+
return $data;
171+
}
172+
169173
// Append missing attributes
170174
foreach ($this->viewAttributes as $attribute => $trans) {
171175
if (! isset($data[0]->{$attribute})) {
172176
$data[0]->{$attribute} = null;
173177
}
174178
}
175179

176-
if ($data->count() === 0) {
177-
return $data;
178-
}
179-
180180
if ($applyFormats) {
181181
$data = $this->format($data);
182182
}

0 commit comments

Comments
 (0)