Notifications
Liste des notifications
GET /notifications?page=1&per_page=20
Authorization: Bearer <token>
Réponse
{
"success": true,
"data": [
{
"id": 1,
"type": "reservation_confirmed",
"title": "Réservation confirmée",
"message": "Votre réservation #BK-ABC123 est confirmée",
"data": {
"reservation_id": 123
},
"read_at": null,
"created_at": "2024-06-01T14:30:00Z"
}
]
}
Marquer comme lu
Une notification
POST /notifications/{id}/read
Authorization: Bearer <token>
Toutes les notifications
POST /notifications/read-all
Authorization: Bearer <token>
Supprimer une notification
DELETE /notifications/{id}
Authorization: Bearer <token>
Types de notifications
| Type | Description |
|---|---|
new_message | Nouveau message reçu |
reservation_confirmed | Réservation confirmée |
reservation_cancelled | Réservation annulée |
payment_received | Paiement reçu |
refund_pending | Remboursement en attente |
refund_approved | Remboursement approuvé |
review_received | Nouvel avis reçu |
Notifications temps réel (WebSocket)
Les notifications sont envoyées en temps réel via WebSocket sur le channel private-user.{id}.
Événement .notification
{
"type": "reservation_confirmed",
"title": "Réservation confirmée",
"message": "Votre réservation #BK-ABC123 est confirmée",
"data": {
"reservation_id": 123
},
"timestamp": "2024-06-01T14:30:00Z"
}
Exemple d'écoute
echo.private(`user.${userId}`)
.listen('.notification', (notification) => {
// Afficher une notification toast
toast(notification.title, {
description: notification.message
});
});
Paramètres de notification
Obtenir les préférences
GET /notifications/settings
Authorization: Bearer <token>
Mettre à jour les préférences
PUT /notifications/settings
Authorization: Bearer <token>
{
"email_notifications": true,
"push_notifications": true,
"marketing_emails": false
}