当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::notify方法代码示例

本文整理汇总了PHP中app\Notification::notify方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::notify方法的具体用法?PHP Notification::notify怎么用?PHP Notification::notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Notification的用法示例。


在下文中一共展示了Notification::notify方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createOrDelete

 public function createOrDelete($id)
 {
     $topic = Topic::find($id);
     if (Favorite::isUserFavoritedTopic(Auth::user(), $topic)) {
         Auth::user()->favoriteTopics()->detach($topic->id);
     } else {
         Auth::user()->favoriteTopics()->attach($topic->id);
         Notification::notify('topic_favorite', Auth::user(), $topic->user, $topic);
     }
     flash()->success('hello!', lang('Operation succeeded.'));
     return Redirect::route('topics.show', $topic->id);
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:12,代码来源:FavoritesController.php

示例2: createOrDelete

 public function createOrDelete($id)
 {
     $topic = Topic::find($id);
     if (Favorite::isUserFavoritedTopic(auth()->user(), $topic)) {
         auth()->user()->favoriteTopics()->detach($topic->id);
     } else {
         auth()->user()->favoriteTopics()->attach($topic->id);
         Notification::notify('topic_favorite', auth()->user(), $topic->user, $topic);
     }
     Flash::success(lang('Operation succeeded.'));
     return redirect()->route('topics.show', $topic->id);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:12,代码来源:FavoritesController.php

示例3: createOrDelete

 public function createOrDelete($id)
 {
     $topic = Topic::find($id);
     if (Attention::isUserAttentedTopic(Auth::user(), $topic)) {
         $message = lang('Successfully remove attention.');
         Auth::user()->attentTopics()->detach($topic->id);
     } else {
         $message = lang('Successfully_attention');
         Auth::user()->attentTopics()->attach($topic->id);
         Notification::notify('topic_attent', Auth::user(), $topic->user, $topic);
     }
     flash()->success('hello!', $message);
     return Redirect::route('topics.show', $topic->id);
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:14,代码来源:AttentionsController.php

示例4: createOrDelete

 public function createOrDelete($id)
 {
     $topic = Topic::find($id);
     if (Attention::isUserAttentedTopic(auth()->user(), $topic)) {
         $message = lang('Successfully remove attention.');
         auth()->user()->attentTopics()->detach($topic->id);
     } else {
         $message = lang('Successfully_attention');
         auth()->user()->attentTopics()->attach($topic->id);
         Notification::notify('topic_attent', auth()->user(), $topic->user, $topic);
     }
     Flash::success($message);
     return redirect()->route('topics.show', $topic->id);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:14,代码来源:AttentionsController.php

示例5: replyUpVote

 public function replyUpVote(Reply $reply)
 {
     if ($reply->votes()->ByWhom(Auth::id())->WithType('upvote')->count()) {
         // click twice for remove upvote
         $reply->votes()->ByWhom(Auth::id())->WithType('upvote')->delete();
         $reply->decrement('vote_count', 1);
     } elseif ($reply->votes()->ByWhom(Auth::id())->WithType('downvote')->count()) {
         // user already clicked downvote once
         $reply->votes()->ByWhom(Auth::id())->WithType('downvote')->delete();
         $reply->votes()->create(['user_id' => Auth::id(), 'is' => 'upvote']);
         $reply->increment('vote_count', 2);
     } else {
         // first time click
         $reply->votes()->create(['user_id' => Auth::id(), 'is' => 'upvote']);
         $reply->increment('vote_count', 1);
         Notification::notify('reply_upvote', Auth::user(), $reply->user, $reply->topic, $reply);
     }
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:18,代码来源:Voter.php

示例6: replyUpVote

 public function replyUpVote(Reply $reply)
 {
     if (auth()->id() == $reply->user_id) {
         return Flash::warning(lang('Can not vote your feedback'));
     }
     if ($reply->votes()->ByWhom(auth()->id())->WithType('upvote')->count()) {
         // click twice for remove upvote
         $reply->votes()->ByWhom(auth()->id())->WithType('upvote')->delete();
         $reply->decrement('vote_count', 1);
     } elseif ($reply->votes()->ByWhom(auth()->id())->WithType('downvote')->count()) {
         // user already clicked downvote once
         $reply->votes()->ByWhom(auth()->id())->WithType('downvote')->delete();
         $reply->votes()->create(['user_id' => auth()->id(), 'is' => 'upvote']);
         $reply->increment('vote_count', 2);
     } else {
         // first time click
         $reply->votes()->create(['user_id' => auth()->id(), 'is' => 'upvote']);
         $reply->increment('vote_count', 1);
         Notification::notify('reply_upvote', auth()->user(), $reply->user, $reply->topic, $reply);
     }
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:21,代码来源:Voter.php

示例7: wiki

 public function wiki($id)
 {
     $topic = Topic::findOrFail($id);
     $this->authorOrAdminPermissioinRequire($topic->user_id);
     $topic->is_wiki = !$topic->is_wiki;
     $topic->save();
     Flash::success(lang('Operation succeeded.'));
     Notification::notify('topic_mark_wiki', auth()->user(), $topic->user, $topic);
     return redirect()->route('topics.show', $topic->id);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:10,代码来源:TopicsController.php


注:本文中的app\Notification::notify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。