Files
einundzwanzig-app/app/helpers.php
2025-11-22 23:53:15 +01:00

16 lines
496 B
PHP

<?php
if (!function_exists('route_with_country')) {
function route_with_country(string $name, array $parameters = [], bool $absolute = true): string
{
if (!isset($parameters['country'])) {
$country = request()->route('country') ?? 'de';
} else {
$country = str(session('lang_country', 'de'))->after('-')->lower();
}
$parameters = ['country' => $country] + $parameters;
return route($name, $parameters, $absolute);
}
}