Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/notifications/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@ pub use laravel_http::url;
pub use laravel_http::validation;
#[doc(hidden)]
pub use laravel_http::view;
#[cfg(feature = "database")]
#[doc(hidden)]
pub use laravel_queue::db;
#[cfg(feature = "database")]
#[doc(hidden)]
pub use laravel_queue::model;
#[doc(hidden)]
pub use laravel_queue::queue;
16 changes: 16 additions & 0 deletions crates/notifications/src/notification.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! `laravel::notification`, which the `laravel-rust` package documents.

#[cfg(feature = "database")]
mod database;
mod fake;
mod slack;

Expand All @@ -20,6 +22,8 @@ use crate::queue::{Attempt, Job, JobOptions, Placement, delivery};
use crate::sms::PhoneNumber;
use crate::time::Moment;

#[cfg(feature = "database")]
pub use self::database::{__DatabaseData, DatabaseMessage, DatabaseNotification, DatabaseNotifications, DatabaseRoute};
#[doc(hidden)]
pub use self::fake::Fakes;
pub use self::fake::{NotificationFake, SentNotification, fake};
Expand Down Expand Up @@ -135,6 +139,18 @@ pub struct Sms;
#[derive(Debug, Clone, Copy)]
pub struct Slack;

/// The database channel, which stores notifications in the `notifications` table for your
/// application to show, such as in a list of unread notifications.
///
/// A notification stores a row with a `database` method in its
/// [`#[notification]`](macro@crate::notification) impl. The method returns the data to store,
/// any value that implements `Serialize`, and the row's type is the notification struct's name in
/// snake case, such as `invoice_paid`. Every [model](crate::model::Model) receives the channel,
/// under its morph name and key. [`DatabaseNotification::of`] reads a model's notifications back.
#[cfg(feature = "database")]
#[derive(Debug, Clone, Copy)]
pub struct Database;

/// A notification's email for one notifiable.
pub trait ToMail<N> {
/// Build the email this notifiable receives.
Expand Down
Loading