Files
services_core/app/Http/Resources/Notification/NotificationDeliveryResource.php
2026-07-31 13:57:11 +07:00

25 lines
751 B
PHP

<?php
namespace App\Http\Resources\Notification;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class NotificationDeliveryResource extends JsonResource
{
public function toArray(Request $request): array
{
$destination = (string) $this->destination;
$masked = strlen($destination) > 6
? substr($destination, 0, 3).str_repeat('*', max(3, strlen($destination) - 6)).substr($destination, -3)
: str_repeat('*', strlen($destination));
return [
...parent::toArray($request),
'destination' => $masked,
'message' => $this->whenLoaded('message'),
'channel_config' => $this->whenLoaded('channelConfig'),
];
}
}