29 lines
824 B
PHP
29 lines
824 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support;
|
|
|
|
use App\Models\SiteSetting;
|
|
|
|
final class PackageContactLink
|
|
{
|
|
/**
|
|
* Resolve the contextual contact link for a wedding package modality.
|
|
*
|
|
* @return array{href: string, isWhatsapp: bool}
|
|
*/
|
|
public static function for(SiteSetting $settings, string $packageName): array
|
|
{
|
|
$digits = preg_replace('/\D/', '', (string) $settings->whatsapp_number);
|
|
$isWhatsapp = strlen($digits) >= 10;
|
|
|
|
return [
|
|
'href' => $isWhatsapp
|
|
? 'https://wa.me/'.$digits.'?text='.rawurlencode('Olá, gostaria de conversar sobre a modalidade '.$packageName.' para meu casamento.')
|
|
: route('briefing', ['servico_interesse' => $packageName]),
|
|
'isWhatsapp' => $isWhatsapp,
|
|
];
|
|
}
|
|
}
|