I using Laravel 7 and I have the topics table that I have 5 status these statuses they are the foreign key from the statuses table.
Topics Table
id | topic | owner_id | status_id |
---|---|---|---|
1 | A | 1 | 2 |
2 | B | 2 | 6 |
3 | C | 3 | 2 |
4 | D | 4 | 6 |
Statuses Table
id | name |
---|---|
1 | Draft |
2 | Waiting for topic approval |
3 | Edit the topic |
4 | Do not approve the topic |
5 | Approved topic |
6 | Waiting for scoring |
7 | Approved score |
I want to notify all admins (user_role=1 on the User Table) when users update a record where status_id = 2 or 6 via e-mail.
Thank you in advance. I’m looking forward to your reply.
lets say a user is editing Topic with id 1.
we have used a class named
TopicUpdateNotification
. this is a notification class and we have to create it with the artisan command.you will find it in your project's
app/Notifications
directory. content for this classand finally make a blade file in the views folder topic_update_email.blade.php
you can find complete laravel notification doc here