From the course: Extending Laravel with First Party Packages

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating an event for new comments

Creating an event for new comments

- [Instructor] Alright. We are finally to the main event. We're going to be creating an event for new comments. So every time that we create a new comment, we are going to broadcast that out to the world, and we're gonna do that through creating a Laravel event. So this is where we're actually going to handle that processing, that broadcasting out, and then we're going to also listen for the events and trigger those dom updates automatically, so all the magic is gonna kinda come together in this video. So in this video, we're going to learn how to create an event whenever a new comment is submitted, and then we're also gonna talk about how we can broadcast the event out to pusher. Okay, so let's go ahead and get started with that process. Now the first step to do here, because remember that all of our comments are working. So we've got the comment working. We can submit the comment. It saves in the database. It returns the response back to the user and everything like that. So it…

Contents