28 lines
666 B
PHP
28 lines
666 B
PHP
<?php
|
|
|
|
namespace App\Transformers\Users;
|
|
|
|
|
|
use Illuminate\Notifications\DatabaseNotification;
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
class NotificationTransformer extends TransformerAbstract {
|
|
protected array $defaultIncludes = [
|
|
];
|
|
|
|
protected array $availableIncludes = [
|
|
|
|
];
|
|
|
|
public function transform(DatabaseNotification $model): array {
|
|
return [
|
|
'id' => $model->id,
|
|
'type' => $model->type,
|
|
'created_at' => $model->created_at,
|
|
'read_at' => $model->read_at ? $model->read_at->toIso8601String() : null,
|
|
'message' => html_entity_decode($model->data['message'])
|
|
];
|
|
}
|
|
|
|
}
|