Initial commit: Animexe Laravel platform

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 00:01:48 +03:00
co-authored by Claude Opus 4.8
commit a63515cfc6
366 changed files with 74773 additions and 0 deletions
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Middleware;
use App\Models\SeoRedirect;
use Closure;
use Illuminate\Http\Request;
class SeoRedirectMiddleware
{
public function handle(Request $request, Closure $next)
{
if ($request->isMethod('GET')) {
try {
$path = '/' . ltrim($request->path(), '/');
$redirect = cache()->remember('seo_redirect_' . md5($path), 300, function () use ($path) {
return SeoRedirect::where('from_path', $path)->where('is_active', true)->first();
});
if ($redirect) {
SeoRedirect::where('id', $redirect->id)->increment('hits');
cache()->forget('seo_redirect_' . md5($path));
return redirect($redirect->to_path, $redirect->type);
}
} catch (\Throwable $e) {
// DB/cache hatası — redirect yerine normal akışa devam et, site çökmesin
\Illuminate\Support\Facades\Log::error('SeoRedirectMiddleware DB error: ' . $e->getMessage());
}
}
return $next($request);
}
}