first
This commit is contained in:
23
modules/Notification/Http/Resources/NotificationResource.php
Normal file
23
modules/Notification/Http/Resources/NotificationResource.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Notification\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class NotificationResource extends JsonResource
|
||||
{
|
||||
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'notification_id' => $this->id,
|
||||
'type' => Str::remove('App\\Notifications\\', $this->type),
|
||||
'title' => $this->data['title'] ?? '',
|
||||
'content' => $this->data['content'] ?? '',
|
||||
'read_at' => (string) $this->read_at,
|
||||
'created_at' => (string) $this->created_at,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user