he Laravel Digest package is a simple way to convert your emails into configurable digests. You can create and send digest emails using various configurable frequency types. For example, using this package, you could send a digest email to the site administrator for every 100 user registrations, a daily digest of all errors logged, or a monthly newsletter for all the posts created.
To use this package, you'll define an observer (i.e., when a new user gets created) that will add a record to the digest:
1use Hmones\LaravelDigest\Facades\Digest; 2 3public function created(User $user) 4{ 5 $batchId = 'userCreated'; 6 $mailable = UserCreatedMailable::class; 7 $data = ['name' => $user->name]; 8 // Frequency can take values such as: 9 // daily, weekly, monthly, custom, or an10 // integer threshold (10, 20, 30, etc.)11 $frequency = 'custom';12 13 Digest::add($batchId, $mailable, $data, $frequency);14}
The Laravel Digest package will take care of everything else from this point on, sending emails once the frequency is met.
To get started with this package, check out the source code on GitHub, including installation instructions and usage details.
0 comments:
Post a Comment
Thanks