'boolean', 'updated_by' => 'integer', ]; /** * Fetch a template by code and variant, falling back to 'default' if needed. * Active only. */ public static function getTemplate(string $code, string $variant = 'default'): ?array { $row = static::query() ->where('code', $code) ->where('variant', $variant) ->where('is_active', 1) ->first(); if ($row) { return $row->toArray(); } $fallback = static::query() ->where('code', $code) ->where('variant', 'default') ->where('is_active', 1) ->first(); return $fallback?->toArray(); } }