<?php

namespace App\Support;

use Illuminate\Support\Facades\Schema;

final class LookupCodeColumn
{
    /** @var array<string, bool> */
    private static array $cache = [];

    public static function exists(string $table): bool
    {
        if (! array_key_exists($table, self::$cache)) {
            self::$cache[$table] = Schema::hasColumn($table, 'code');
        }

        return self::$cache[$table];
    }
}
