Proje: Okul Platform · Hub: Okul Platform — Conventions

Route Grupları (bootstrap/app.php)

GET /up                           → Health check
/api/ general routes              → ['api', 'platform']
/api/auth/ routes                 → ['api']
/api/admin/ routes                → ['api', 'auth:sanctum', 'platform', 'user-group-type:admin']
/api/customer/ routes             → ['api', 'auth:sanctum', 'platform', 'user-group-type:customer,admin']
/api/migration/ routes            → ['api', MigrationWebhookMiddleware]
/api/webhooks/ external-webhooks  → ['api']
/api/outsource/ routes            → ayrı (multi-domain)

platform middleware = VerifyConsumerTokenx-consumer-key header zorunlu

Global Middleware

DetectLocale  — Accept-Language → app locale
CastBooleans  — string bool'ları bool'a çevir

Rate Limiting

RateLimiter::for('api', function ($request) {
    return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});

60 istek/dakika, auth ise user ID’ye, değilse IP’ye göre.

Exception Handler

Raporlanmayan Exception’lar (dontReport)

MediaException, OtpCodeException, LoginFailedException
LeadException, CommandNotFoundException

Bu hataları Sentry’e göndermez.

HTTP Yanıt Dönüşümleri

AuthenticationException → JsonResponse::unauthorized()
UnauthorizedException   → JsonResponse::forbidden()
AccessDeniedHttpException → JsonResponse::forbidden()
NotFoundHttpException   → JsonResponse::notFound()
  └─ ModelNotFoundException → "Kayıt bulunamadı"
  └─ Route not found       → "Aradığınız sayfa bulunamadı"
ValidationException     → JsonResponse::unprocessable()

Slack 404 Logging

404 hataları slack_404_errors kanalına loglanır.

Slack Error Logging (DEVRE DIŞI)

// Not working. Must be fixed before enabling it.
// @ege 2025-12-09
// Production'da tüm hataları slack'e gönder — henüz çalışmıyor

Customer Portal: Admin de Girebilir

user-group-type:customer,admin — Admin kullanıcılar da customer portal’ına erişebilir. Bu sayede support/admin, müşteri adına işlem yapabilir.