本文整理汇总了PHP中app\Notification::isNotified方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::isNotified方法的具体用法?PHP Notification::isNotified怎么用?PHP Notification::isNotified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Notification
的用法示例。
在下文中一共展示了Notification::isNotified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
public static function notify($type, User $fromUser, User $toUser, Topic $topic, Reply $reply = null)
{
if (Notification::isNotified($fromUser->id, $toUser->id, $topic->id, $type)) {
return;
}
$nowTimestamp = Carbon::now()->toDateTimeString();
$data = ['from_user_id' => $fromUser->id, 'user_id' => $toUser->id, 'topic_id' => $topic->id, 'reply_id' => $reply ? $reply->id : 0, 'body' => $reply ? $reply->body : '', 'type' => $type, 'created_at' => $nowTimestamp, 'updated_at' => $nowTimestamp];
$toUser->increment('notification_count', 1);
Notification::insert([$data]);
self::pushNotification($data);
}
示例2: nonamenotify
public static function nonamenotify($type, User $toUser, Article $article, Reply $reply = null)
{
// if ($fromUser->id == $toUser->id) {
// return;
// }自己不通知自己
if (Notification::isNotified(null, $toUser->id, $article->id, $type)) {
return;
}
$nowTimestamp = Carbon::now()->toDateTimeString();
$data[] = ['user_id' => $toUser->id, 'article_id' => $article->id, 'reply_id' => $reply ? $reply->id : 0, 'body' => $reply ? $reply->body : '', 'type' => $type, 'created_at' => $nowTimestamp, 'updated_at' => $nowTimestamp];
$toUser->increment('notification_count', 1);
Notification::insert($data);
}