forked from admin/services_core
25 lines
751 B
PHP
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'),
|
|
];
|
|
}
|
|
}
|