fix(price-trigger): restrict notifications to SMS only

Remove email/in-app paths and enforce sms action on create/update so
price alerts match the product requirement for SMS-only delivery.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-19 19:02:46 +03:30
co-authored by Cursor
parent 832a7683fb
commit 5b2ed2e5fc
3 changed files with 10 additions and 8 deletions
+5 -7
View File
@@ -3,13 +3,11 @@
namespace App\Services;
use App\Http\Controllers\Controller;
use App\Mail\YourMailableClass;
use App\Models\Customer;
use App\Models\Price;
use App\Models\PriceTrigger;
use App\Models\Product;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
class PriceTriggerService
{
@@ -167,14 +165,14 @@ class PriceTriggerService
$shopName = (string) Controller::Config('name_fa');
$message = 'قیمت ' . $title . ' به ' . number_format((int) $current) . " رسید\n" . $shopName;
if ($trigger->action === 'email' && ! empty($customer->email)) {
Mail::to($customer->email)->send(new YourMailableClass($message, '', '', '', ''));
if (! Controller::isSmsNotifEnabled('sms_notif_price_trigger')) {
return;
}
if ($trigger->action === 'sms' && Controller::isSmsNotifEnabled('sms_notif_price_trigger')) {
Controller::Send($customer->mobile, $message);
if (trim((string) ($customer->mobile ?? '')) === '') {
return;
}
Controller::Send($customer->mobile, $message);
}
}