'boolean', 'updated_by' => 'integer', 'updated_at' => 'datetime', ]; /** * Fetch a template by code and variant, falling back to 'default' if needed. * Active only. */ public static function getTemplate(string $code, string $variant = 'default'): ?self { // Try exact active $row = static::query() ->where('code', $code) ->where('variant', $variant) ->where('is_active', true) ->first(); if ($row) return $row; // Fallback to default variant return static::query() ->where('code', $code) ->where('variant', 'default') ->where('is_active', true) ->first(); } }