Версия 0.1.0 #1

Merged
kor-elf merged 20 commits from develop into main 2024-04-24 21:56:47 +05:00
Showing only changes of commit 481dcac2cc - Show all commits

View File

@ -5,6 +5,7 @@
use App\Enums\CacheTag; use App\Enums\CacheTag;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
final class ProjectDomainAndLanguage extends ProjectLanguage final class ProjectDomainAndLanguage extends ProjectLanguage
@ -12,6 +13,12 @@ final class ProjectDomainAndLanguage extends ProjectLanguage
public function handle(Request $request, Closure $next): Response public function handle(Request $request, Closure $next): Response
{ {
$httpHost = $request->getSchemeAndHttpHost(); $httpHost = $request->getSchemeAndHttpHost();
if (
config('app.force_https') === true
&& Str::startsWith($httpHost, 'http://')
) {
$httpHost = Str::of($httpHost)->replaceFirst('http://', 'https://')->toString();
}
$seconds = 3600; $seconds = 3600;
$project = CacheTag::Project->getCache()->remember(self::class . $httpHost, $seconds, function () use ($httpHost) { $project = CacheTag::Project->getCache()->remember(self::class . $httpHost, $seconds, function () use ($httpHost) {