【发布时间】:2021-03-05 07:42:50
【问题描述】:
现在我有一个有效的帖子创建功能,可以创建帖子并向用户发送帖子已创建的通知。如果帖子的作者想在某个日期发布帖子,我该如何管理。假设他们填写了一个发布日期,我希望控制器在该发布日期上创建帖子。现在它只是创建帖子并立即发送通知。
public function create()
{
$post = Post::create([
'title'=>$request->title,
'details'=>$request->details,
'publish_date'=> $request->publish_date
]);
User::get()->each->notify(new PostCreated($post)); //sends notification to user using queue and redis
}
【问题讨论】:
-
我认为它只回答了我的部分问题,另一部分是如何部署通知? @AdamP。