27 خطوط
713 B
PHP
27 خطوط
713 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class NotificationResource extends JsonResource
|
|
{
|
|
public static $wrap = null;
|
|
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'title' => $this->title,
|
|
'message' => $this->message,
|
|
'type' => $this->type,
|
|
'data' => $this->data ?? [],
|
|
'is_read' => (bool) $this->is_read,
|
|
'read_at' => $this->read_at?->toISOString(),
|
|
'archived_at' => $this->archived_at?->toISOString(),
|
|
'created_at' => $this->created_at?->toISOString(),
|
|
];
|
|
}
|
|
}
|