本文整理汇总了PHP中Reply::notification方法的典型用法代码示例。如果您正苦于以下问题:PHP Reply::notification方法的具体用法?PHP Reply::notification怎么用?PHP Reply::notification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reply
的用法示例。
在下文中一共展示了Reply::notification方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reply
/**
* Send a reply
*
* @param int $id
* @return Response
*/
public function reply($id)
{
$chat = Chat::findOrfail($id);
$chat->last_reply = date("Y-m-d H:i:s");
$chat->save();
$reply = new Reply();
$reply->text = Input::get('text');
$reply->chat_id = $chat->id;
$reply->user_id = Auth::user()->id;
$reply->save();
//Set up notifications for this chat
foreach ($chat->user()->get() as $user) {
$reply->notification()->save($user);
}
$notification = Notification::where('user_id', '=', Auth::user()->id)->where('reply_id', '=', $reply->id)->firstOrFail();
$notification->has_read = 1;
$notification->save();
return Redirect::to('/community/chats/' . $id)->with('flash_chat', 'Your chat has been sent!')->with('alert_class', 'alert-success');
}