Add notification action foundation
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\NotificationAction;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class NotificationActionResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'name' => $this->name,
|
||||
'enabled' => $this->enabled,
|
||||
'event_type' => $this->event_type->value,
|
||||
'event_type_label' => $this->event_type->label(),
|
||||
'channel' => $this->channel->value,
|
||||
'channel_label' => $this->channel->label(),
|
||||
'channel_configuration' => $this->channel_configuration ?? [],
|
||||
'has_delivery_url' => $this->resource instanceof NotificationAction && filled($this->delivery_url),
|
||||
'message_template' => $this->message_template,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user