A lot of things.

This commit is contained in:
2026-06-08 16:25:52 +02:00
parent 6f6d6b9b84
commit f529f74823
94 changed files with 9178 additions and 107 deletions

View File

@@ -24,3 +24,40 @@ if( !function_exists( 'section_must_not_be' ) ){
}
}
if( !function_exists( 'databaseRoute' ) ){
function databaseRoute( array $params = [] ): string
{
$defaults = [
'types' => [],
'platforms' => [],
'genres' => [],
'games' => [],
'statuses' => [],
'authors' => [],
'authorsMode' => 'or',
'languages' => [],
'languagesMode' => 'or',
'modifications' => [],
'modificationsMode' => 'or',
'sort' => 'created_at',
'dir' => 'desc',
's' => ''
];
$query = array_filter(
array_merge($defaults, $params),
fn($v,$k) => match(true){
is_array($v) => !empty($v),
in_array($k, ['authorsMode', 'languagesMode', 'modificationsMode']) => $v !== 'or',
$k === 'sort' => $v !== 'created_at',
$k === 'dir' => $v !== 'desc',
default => $v !== '',
},
ARRAY_FILTER_USE_BOTH
);
return route('entries.index', $query );
}
}