feat: ds
This commit is contained in:
@@ -114,8 +114,9 @@ class PageVisitController extends Controller
|
||||
$q->where('channel_id', 'like', '%'.$channelId.'%');
|
||||
}
|
||||
|
||||
if ($request->query->has('chain') && $request->query('chain') !== '') {
|
||||
$q->where('chain', (int) $request->query('chain'));
|
||||
$chain = $this->parseChainFilter($request->query('chain'));
|
||||
if ($chain !== null) {
|
||||
$q->where('chain', $chain);
|
||||
}
|
||||
|
||||
$os = trim((string) $request->query('os', ''));
|
||||
@@ -149,6 +150,26 @@ class PageVisitController extends Controller
|
||||
return $q;
|
||||
}
|
||||
|
||||
/** Empty / missing / all = no chain filter. */
|
||||
private function parseChainFilter(mixed $raw): ?int
|
||||
{
|
||||
if ($raw === null) {
|
||||
return null;
|
||||
}
|
||||
$value = is_string($raw) ? strtolower(trim($raw)) : $raw;
|
||||
if ($value === '' || $value === 'all' || $value === []) {
|
||||
return null;
|
||||
}
|
||||
if ($value === 0 || $value === '0' || $value === 'coruna') {
|
||||
return PageVisit::CHAIN_CORUNA;
|
||||
}
|
||||
if ($value === 1 || $value === '1' || $value === 'darksword' || $value === 'ds') {
|
||||
return PageVisit::CHAIN_DARKSWORD;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{0: Carbon, 1: Carbon}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user