Commit 805b7d54 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix AppConfigController: fallback to first academy for public endpoints

Single-academy deployments don't have current_academy bound for
unauthenticated API requests. Fall back to Academy::first() so
/api/v1/app/config works without auth.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent dc79c433
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api\V1;
use App\Domain\Shared\Models\Academy;
use App\Domain\Shared\Models\SystemSetting;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
......@@ -10,7 +11,11 @@ class AppConfigController extends Controller
{
public function index(): JsonResponse
{
$academy = app('current_academy');
$academy = app()->bound('current_academy') ? app('current_academy') : null;
if (!$academy) {
$academy = Academy::first();
}
if (!$academy) {
return response()->json([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment