feat: add persistent mobile notifications
CI / 🧪 Tests Laravel (push) Successful in 2m7s
CI / 🐳 Build & Push Image (push) Successful in 42s

This commit is contained in:
2026-08-11 16:46:05 +02:00
parent bd1b4bba20
commit df4f523089
24 changed files with 822 additions and 75 deletions
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class NotificationResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
$data = is_array($this->data) ? $this->data : [];
return [
'id' => $this->id,
'type' => $data['type'] ?? $this->type,
'category' => $data['category'] ?? 'account',
'title' => $data['title'] ?? __('api.notifications.default_title'),
'body' => $data['body'] ?? '',
'url' => $data['url'] ?? null,
'readAt' => $this->read_at?->toISOString(),
'createdAt' => $this->created_at?->toISOString(),
];
}
}