本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}