Laravel 5 当发送通知或模式弹出窗口时,将隐藏Laravel侧栏菜单
我有这个问题,当我的网站项目的通知被发送时,或当一个模态弹出我的侧边栏菜单消失,以及标志。这是一个更容易理解的屏幕截图……我使用pusher发送实时通知,但当它发送通知时,会出现上述情况,需要刷新页面,以便再次看到菜单和徽标。这里我使用了laravel控制器来触发pusher事件这里是我的代码Laravel 5 当发送通知或模式弹出窗口时,将隐藏Laravel侧栏菜单,laravel-5,pusher,Laravel 5,Pusher,我有这个问题,当我的网站项目的通知被发送时,或当一个模态弹出我的侧边栏菜单消失,以及标志。这是一个更容易理解的屏幕截图……我使用pusher发送实时通知,但当它发送通知时,会出现上述情况,需要刷新页面,以便再次看到菜单和徽标。这里我使用了laravel控制器来触发pusher事件这里是我的代码 `class PublicController extends Controller { public function notify(){ $token = Session::
`class PublicController extends Controller
{
public function notify(){
$token = Session::get('utoken');
User::where('token', $token)->update(['notify' => 1]);
\Helper::calculateResult($token);
User::where('token', $token)->update(['status' => 'finish']);
$notify = DB::table('users')->where('notify', 1)->select('name','id')->get();
$notify=$notify->toArray();
event(new ExamSubmitted($notify));
return view('finish');
}
}`
在我的刀锋中,我的头部标签上有这个脚本
<script>
Pusher.logToConsole = true;
var pusher = new Pusher('pusher_key', {
cluster: 'ap1'
});
var channel = pusher.subscribe('exam-channel');
channel.bind('exam-event', function(data) {
$("span").remove();
$(".notif").empty();
if(data['notify'].length>0){
$("#notify").append("<span class='badge custom-badge'>"+data['notify'].length+"</span>");
data['notify'].forEach(function(value){
$(".notif").append(
"<li> <a id='app_modal' data-id ="+value['id']+" href='javascript:void(0)'>"
+"<div class='row'>"
+" <div class='col-sm-2'><img src=\"{{asset('/images/user/user.jpg')}}\"class='img-size-50 img-circle'></div>"
+"<div class='col-sm-8' style='line-height: .5;'>"
+"<p style='font-size: 1.6rem'>"+value['name']+"</p>"
+"<p style='font-size: 1.2rem'>Just Completed the exam.</p>"
+"<p class='text-sm text-muted'><i class='fa fa-clock mr-1'></i> 4 Hours Ago</p>"
+"</div>"+
"<div class='col-sm-2 text-success'><i class='fa fa-star fa-lg'></i></div>"
+"</div></div></a>"+
"</li><div class='dropdown-divider'>"
);
});
}
});
</script>
Pusher.logToConsole=true;
var pusher=新的pusher(“pusher\U键”{
群集:“ap1”
});
var通道=pusher.subscribe('exam-channel');
channel.bind('exam-event',函数(数据){
$(“span”).remove();
$(“.notif”).empty();
如果(数据['notify'].长度>0){
$(“#notify”).append(“+data['notify'].length+”);
数据['notify'].forEach(函数(值){
$(“.notif”).append(
“”+
“ ”
);
});
}
});
我做错什么了吗