Files
Verde-Web/app/Notifications/PickupImminent.php
2026-06-30 14:06:21 +08:00

50 lines
1.4 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\DropOffPoint;
use App\Notifications\Concerns\RoutesByPreferences;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class PickupImminent extends Notification
{
use Queueable, RoutesByPreferences;
public const PREF_KEY = 'pickup_imminent';
public function __construct(public readonly DropOffPoint $dropOff) {}
public function toArray(mixed $notifiable): array
{
return [
'type' => 'pickup.imminent',
'drop_off_point_id' => $this->dropOff->uuid,
'drop_off_name' => $this->dropOff->name,
'message' => "The collection truck just arrived at {$this->dropOff->name}. Bring your bags now.",
'action_label' => 'Track Pickup',
'action_url' => '/pickups',
];
}
public function toSms(mixed $notifiable): array
{
return [
'to' => $notifiable->phone,
'message' => "Verde: Truck just arrived at {$this->dropOff->name}. Drop off your bags now.",
];
}
public function toPush(mixed $notifiable): array
{
return [
'title' => 'Pickup imminent',
'body' => "Truck arrived at {$this->dropOff->name}. Drop your bags now.",
'data' => [
'type' => 'pickup.imminent',
'drop_off_point_id' => $this->dropOff->uuid,
],
];
}
}