我有一个奇怪的问题。我有两个通知类 InterviewRequestReceived.php 和 SendJobSeekerResume.php。我正在尝试使用小铃铛图标旁边显示通知总数count(),然后显示与相应通知类相关的消息。消息很简单,它们位于 /layouts/partials/notification 中。
1. interview_request_received.blade.php
<div>
<span class="font-weight-bold">You've been sent an Interview request!</span>
</div>
2. send_job_seeker_resume.blade.php
<div>
<span class="font-weight-bold">You've been sent a new Job Profile!</span>
</div>
在我的管理文件中,我有 2 个角色,具体取决于用户是作为求职者还是雇主登录。admin.blade.php:
两个项目role_id === 1都在工作,我得到了计数和带有消息的项目,但是role_id === 2我得到计数 0 的项目并且没有带有消息的项目,这很奇怪。当然,我正在查看和测试 2 个帐户,其中我将 role_id 设置为 1 或将 role_id 设置为 2。
这是我的通知表的屏幕截图:

当我使用 user_id 12(也将 role_id 设置为 2)登录时,它应该显示所有 notifiable_id 设置为 12 的通知。
我死掉了我的两个模型,看看是否有通知,像这样的employeesProfile 和jobSeekerProfile 模型,我可以看到我的employeesProfile 模型中没有通知,它只是一个空数组。下面是截图。
dd($employerProfile->notifications);
杨__羊羊
函数式编程
随时随地看视频慕课网APP