Implement a comprehensive notification system using Kavenegar SMS
gateway and enhance system traceability through audit logging and
detailed shipment status history.
- SMS Integration:
- Add Kavenegar SMS service with configurable API keys and sender
numbers via system settings.
- Implement automated SMS notifications for shipment approval,
rejection, successful payments, and tracking updates.
- Add administrative UI in Filament to manage SMS gateway settings
and toggle specific notification types.
- Audit & Tracking:
- Apply `Auditable` trait to core models (User, Shipment, Wallet,
etc.) to track changes.
- Refactor `ShipmentStatusHistory` to include status transitions
(`from_status` to `to_status`) and specific reasons for changes.
- Implement `ShipmentObserver` to automate notification triggers
on status changes.
- Database & Config:
- Add migrations for enhanced shipment status history tracking.
- Update `.env.example` and `config/ifnex.php` with Kavenegar
configuration parameters.
36 lines
1017 B
PHP
36 lines
1017 B
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class TrackingUpdatedSms extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(public string $awbNo, public string $status, public string $location) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database', 'sms'];
|
|
}
|
|
|
|
public function toSms(User $notifiable): ?string
|
|
{
|
|
return "وضعیت سفارش شما تغییر کرد.\nشماره پیگیری: {$this->awbNo}\nوضعیت: {$this->status}\nمحل: {$this->location}";
|
|
}
|
|
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
'title' => 'بهروزرسانی رهگیری',
|
|
'body' => "وضعیت سفارش {$this->awbNo} به {$this->status} تغییر کرد.",
|
|
'awb_no' => $this->awbNo,
|
|
'status' => $this->status,
|
|
'location' => $this->location,
|
|
];
|
|
}
|
|
}
|