简体   繁体   English

我正在开发一个博客网站,当作者写博客时,通知会发送给 laravel 的管理员

[英]I am am developing a blog site in which when a writer write blog a notification send to admin in laravel

i am trying to develop an blogging site in which new blog activity show to admin when any writer write blog.我正在尝试开发一个博客网站,当任何作家写博客时,都会向管理员显示新的博客活动。 how can i take all notification of all blogger except auth user.我如何接收除 auth 用户之外的所有博主的所有通知。 when user submit blog notification generated in notification table.当用户提交通知表中生成的博客通知时。 below mention line fatch auth user data but i need all other user data except admin.下面提到行 fatch auth 用户数据,但我需要除管理员之外的所有其他用户数据。 i use spatie for role and permission我使用 spatie 作为角色和权限

@role('admin')
@foreach(auth()->user()->unreadnotifications as $notify)                                
<div class="dropdown-menu dropdown-menu-lg-right dropdown-secondary" aria- 
labelledby="navbarDropdownMenuLink-5">
<a class="dropdown-item waves-effect waves-light" href="#"> {{$notify->data['message']}}<span 
class="badge badge-danger ml-2">4</span></a>
</div>
@endforeach
@endrole

in your scenario you just take all the auth users notifications.That's why you will get only the current logged in users notifications.在您的场景中,您只需接收所有 auth 用户通知。这就是为什么您只会收到当前登录用户的通知。 you have to take all notifications except the admin like您必须接受除管理员之外的所有通知,例如

$notifications = Notification::where('user_id','!=',1)->get();

and then in view, you can try like these然后在视图中,您可以尝试这些

@foreach($notifications as $notify)
<div class="dropdown-menu dropdown-menu-lg-right dropdown-secondary" aria- 
labelledby="navbarDropdownMenuLink-5">
<a class="dropdown-item waves-effect waves-light" href="#"> {{$notify->data['message']}}<span 
class="badge badge-danger ml-2">4</span></a>
</div>
@endforeach

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我在wordpress CMS上发布博客时出现错误 - Gives error while i am posting a blog on wordpress CMS 开发博客站点,在编辑模式下显示文本时遇到问题 - Developing a blog site, having issues displaying text while in edit mode 需要向现有的 laravel 站点添加一个简单的博客 - Need add a simple blog to existing laravel site 我在laravel中开发注册表,但是单击“提交”按钮时,它不会重定向到我的登录页面,这是为什么? - i am developing a registration form in laravel but when the submit button is clicked it wont redirect to my login page why is that? 我正在使用Laravel Notification,如果只有电子邮件地址可用,我想发送电子邮件 - I am working with Laravel Notification I want to send Email if only Email address is avaiable 我无法在 url 友好博客详细信息页面上使用 ajax 发布数据,我已经在查询中使用 url 值 - I am unable to post data using ajax on url friendly blog detailing page where I am already using url value in Query 用户访问我的网站时为什么会收到电子邮件通知? - Why am I getting an email notification when users go to my site? 更新 laravel 中的博客文章时出错 - Error when updating a blog post in laravel 我正在开发一个视频网站,管理员可以在其中上传1 GB大小的视频,以及可以使用的服务器,以便可以在前端正常播放 - I am developing a video website in which admin will upload 1 GB size of videos, what server I can use so that it can be play properly on front end 如何根据laravel中的admin_id删除一个Blog? - How to delete a Blog based on admin_id in laravel?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM