#Frontend. How to update a list of models & show message on notification broadcast?

1 messages · Page 1 of 1 (latest)

fluid ice
#

I will write up some solutions

#
  1. Reload the page, and flash message on Notification Broadcast
// csvs.index.vue
useEchoNotification(
    `App.Models.User.${userId.value}`,
    (notification) => {
        router.get(route("csvs.index"), {
            success: true,
        });
    },
    "App.Notifications.ExportDatabaseCompleted",
);
// Controller
if ($success) {
    return Inertia::render('csvs/Index', [
        'csvs' => CsvResource::collection(Csv::latest()->paginate(15)),
    ])->with('notification', 'CSV successfully exported.');
}