mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Adds a dedicated, browsable notification history (PriceGhost parity, task 6) on top of the existing database notifications that price/stock/ scrape-fail alerts already write. - App\Models\Notification: thin model over the notifications table - NotificationHistoryResource (System nav, read-only): lists the current user's PriceBuddy notifications with a type badge, title/body, and relative time; filter by type and read/unread; row action to open the related product; bulk delete to clear; 'Mark all as read' header action - Scoped to the current user (whereMorphedTo) and to PriceBuddy notification types, so users only ever see their own - The bell-drawer badge for recent notifications is already provided by Filament's databaseNotifications() Tests cover the privacy scoping, type filtering and type metadata. Docs updated (products). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
608 B
PHP
22 lines
608 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Notifications\DatabaseNotification;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* Eloquent model over Laravel's `notifications` table, used to present a
|
|
* browsable notification history. Sent notifications (price alerts, back-in-stock
|
|
* alerts, scrape errors) are written here by the database notification channel.
|
|
*
|
|
* @property string $type
|
|
* @property array $data
|
|
* @property ?Carbon $read_at
|
|
* @property Carbon $created_at
|
|
*/
|
|
class Notification extends DatabaseNotification
|
|
{
|
|
// Table, uuid key and `data`/`read_at` casts are inherited from the parent.
|
|
}
|