DateFormat::class, 'time_format' => TimeFormat::class, 'fiscal_year_start' => 'date', 'fiscal_year_end' => 'date', 'week_start' => WeekStart::class, 'number_format' => NumberFormat::class, ]; public function company(): BelongsTo { return $this->belongsTo(FilamentCompanies::companyModel(), 'company_id'); } public function createdBy(): BelongsTo { return $this->belongsTo(FilamentCompanies::userModel(), 'created_by'); } public function updatedBy(): BelongsTo { return $this->belongsTo(FilamentCompanies::userModel(), 'updated_by'); } public static function getLocale(string $language, string $countryCode): string { $fullLocale = "{$language}_{$countryCode}"; if (in_array($fullLocale, ResourceBundle::getLocales(''), true)) { return $fullLocale; } return $language; } public static function getWeekStart(string $locale): int { /** @var Carbon $date */ $date = now()->locale($locale); $firstDay = $date->startOfWeek()->dayOfWeekIso; return WeekStart::from($firstDay)->value ?? WeekStart::DEFAULT; } public static function isPercentFirst(string $language, string $countryCode): bool { $test = 25; $fullLocale = "{$language}_{$countryCode}"; $formatter = new NumberFormatter($fullLocale, NumberFormatter::PERCENT); $formattedPercent = $formatter->format($test); return strpos($formattedPercent, '%') < strpos($formattedPercent, $test); } public function getDateTimeFormatAttribute(): string { return $this->date_format . ' ' . $this->time_format; } public static function getAllLanguages(): array { return Transmatic::getSupportedLanguages(); } public static function newFactory(): Factory { return LocalizationFactory::new(); } }