where('status', 1) ->pluck('iframe_allowed_origins') ->flatMap(static function (mixed $value): array { if (is_string($value)) { $decoded = json_decode($value, true); $value = is_array($decoded) ? $decoded : []; } if (! is_array($value)) { return []; } return array_values(array_filter( array_map( static fn (mixed $origin): string => is_string($origin) ? trim($origin) : '', $value, ), static fn (string $origin): bool => $origin !== '', )); }) ->unique() ->values() ->all(); return ApiResponse::success([ 'iframe_allowed_origins' => $origins, ]); } }