Skip to content

Commit

Permalink
Updating the search method in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Feb 10, 2022
1 parent d968af7 commit ba0c14e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Http/Controllers/LogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ public function search(Request $request, $date, $level = 'all')
$entries = $log->entries($level)
->unless(empty($needles), function (LogEntryCollection $entries) use ($needles) {
return $entries->filter(function (LogEntry $entry) use ($needles) {
return Str::containsAll(Str::lower($entry->header), $needles);
foreach ([$entry->header, $entry->stack, $entry->context()] as $subject) {
if (Str::containsAll(Str::lower($subject), $needles))
return true;
}

return false;
});
})
->paginate($this->perPage);
Expand Down

0 comments on commit ba0c14e

Please sign in to comment.