53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use App\Models\Setting;
|
|
|
|
final class MailGlobals
|
|
{
|
|
public const LABELS = [
|
|
'company_name' => 'Tên công ty',
|
|
'app_name' => 'Tên hệ thống',
|
|
'company_logo' => 'Logo công ty (URL)',
|
|
'support_email' => 'Email hỗ trợ',
|
|
'support_phone' => 'Hotline hỗ trợ',
|
|
'frontend_url' => 'Địa chỉ portal khách hàng',
|
|
'login_url' => 'Link đăng nhập',
|
|
'current_year' => 'Năm hiện tại',
|
|
'today' => 'Ngày hiện tại',
|
|
];
|
|
|
|
public static function frontendUrl(): string
|
|
{
|
|
return rtrim((string) (config('app.frontend_url') ?: config('app.url')), '/');
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public static function values(): array
|
|
{
|
|
try {
|
|
$setting = json_decode((string) Setting::where('key', 'setting')->value('value'), true) ?: [];
|
|
} catch (\Throwable) {
|
|
$setting = [];
|
|
}
|
|
|
|
$companyName = $setting['company'] ?? config('app.name', 'The Gioi So');
|
|
$frontendUrl = self::frontendUrl();
|
|
|
|
return [
|
|
'company_name' => $companyName,
|
|
'app_name' => $companyName,
|
|
'company_logo' => $setting['logo'] ?? '',
|
|
'support_email' => $setting['email'] ?? config('mail.support_email', 'support@thegioiso.com'),
|
|
'support_phone' => $setting['hotline'] ?? $setting['phone'] ?? config('mail.support_phone', '1900.xxxx'),
|
|
'frontend_url' => $frontendUrl,
|
|
'login_url' => $frontendUrl . '/dang-nhap',
|
|
'current_year' => now()->format('Y'),
|
|
'today' => now()->format('d/m/Y'),
|
|
];
|
|
}
|
|
}
|