Skip to content

Commit

Permalink
Only push results to collection, when results were found
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardK91 committed Sep 26, 2022
1 parent 5ae1968 commit 0641d17
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Models/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,20 @@ private function archive(string $archive, array $arguments, bool $kopf = true)
try {

if($kopf) {
$result->push(DB::connection('bios2000')->table($tableName)
$item = DB::connection('bios2000')->table($tableName)
->where($arguments)
->orderBy('VERSION', 'desc')
->get()->all());
->get()->all();
} else {
$result->push(DB::connection('bios2000')->table($tableName)
$item = DB::connection('bios2000')->table($tableName)
->where('POSITIONS_NR', '!=', null)
->where($arguments)
->orderBy('VERSION', 'desc')
->get()->all());
->get()->all();
}

if (count($item) > 0) {
$result->push($item);
}

} catch (Exception $e) {
Expand Down

0 comments on commit 0641d17

Please sign in to comment.