PHP code example of goldnead / statamic-notifications
1. Go to this page and download the library: Download goldnead/statamic-notifications library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
goldnead / statamic-notifications example snippets
use Goldnead\Notifications\Facades\Notifications;
Notifications::notify($user, 'community.mention', [
'message' => 'Bea hat dich erwähnt.',
'link' => '/account/community/posts/'.$post->id,
'dedupe_key' => 'mention:'.$mention->id,
]);
Notifications::unreadCount($user);
Notifications::markRead($item);
use Goldnead\Notifications\Facades\Notifications;
Notifications::notify($user, 'community.mention', [
'actor' => $author, // anything IdentityContext can resolve
'subject' => $post, // any Eloquent model
'message' => 'Bea hat dich erwähnt.',
'link' => '/account/community/posts/'.$post->id,
'dedupe_key' => 'mention:'.$mention->id,
]);
Notifications::notifyMany($subscribers, 'lms.lesson_published', [
'dedupe_key' => 'lesson:'.$lesson->id, // scoped per recipient automatically
]);
$preferences = app(PreferenceResolver::class);
$preferences->set($user, 'community.mention', 'mail', false);
$preferences->matrixFor($user); // for a preference centre