First public release. - docs: document the audit log, user offboarding, CSV export and the "require a reason for destructive actions" setting across README, docs/ and CLAUDE/AGENTS.md; note retention for panel_audit - docs: fill the publishing placeholders (repo URL, security contact, issue-template links) and add a semantic-versioning policy - move agent/contributor context into CLAUDE/ (AGENTS.md + a README); root CLAUDE.md is now a thin @-import pointer - add a favicon (shield-lock, matching the login screen) to the login page and the app layout - CHANGELOG: promote [Unreleased] to [1.0.0]; keep the earlier internal build as [0.1.0] Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UfuvfwexztdS7LDpGuKsuK
36 lines
1005 B
PHP
36 lines
1005 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\App;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
/**
|
|
* Ustawia język aplikacji na podstawie wyboru użytkownika.
|
|
*
|
|
* Kolejność źródeł: sesja ('locale') -> cookie ('locale') -> domyślny
|
|
* z config('app.locale'). Wartość musi być jednym z config('locales'),
|
|
* w przeciwnym razie jest ignorowana (zostaje język domyślny).
|
|
*/
|
|
class SetLocale
|
|
{
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
$supported = array_keys(config('locales', []));
|
|
|
|
$locale = $request->session()->get('locale')
|
|
?? $request->cookie('locale')
|
|
?? config('app.locale');
|
|
|
|
if (in_array($locale, $supported, true)) {
|
|
App::setLocale($locale);
|
|
// Utrwal wybór w sesji, gdy przyszedł tylko z cookie.
|
|
$request->session()->put('locale', $locale);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|