fix: make untagged search work for no-js view too

This commit is contained in:
Floorb 2023-05-19 06:31:20 -04:00
parent 2bccaf408f
commit a1cbbc3587

View file

@ -35,11 +35,15 @@ $pastes = Paste::with([
if (!empty($filter_value)) { if (!empty($filter_value)) {
if ($filter_value === 'untagged') {
$pastes = $pastes->doesntHave('tags');
} else {
$pastes = $pastes->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%') $pastes = $pastes->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%')
->orWhereHas('tags', function($q) use ($filter_value) { ->orWhereHas('tags', function($q) use ($filter_value) {
$q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%'); $q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%');
}); });
} }
}
$total_results = $pastes->count(); $total_results = $pastes->count();