validate([ 'code' => ['required', 'string', 'max:64'], ]); $tenant = Tenant::where('code', strtoupper($data['code']))->first(); if (! $tenant) { return $this->fail('Unknown LGU code', null, 404); } if ($tenant->status !== Tenant::STATUS_ACTIVE) { return $this->fail('LGU is not currently active', null, 403); } return $this->ok([ 'id' => $tenant->uuid, 'code' => $tenant->code, 'name' => $tenant->name, 'short_name' => $tenant->short_name, 'theme_color' => $tenant->theme_color, 'logo_path' => $tenant->logo_path, 'timezone' => $tenant->timezone, 'contact_email' => $tenant->contact_email, 'contact_phone' => $tenant->contact_phone, ]); } }