當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。