@iamamirsalehi can you dd($current_user_notification_count) to see if it has value?
Mar 10, 2021
10
Level 2
View composer is not working
Hey there, I'm using View composer for passing some data to the master layout but it actually passes nothing to the view, What's the problem?
View::composer('layouts.dashboard.master', function($view){
$userNoteRepository = resolve(UserNoteRepositoryInterface::class);
$current_user_notification = $userNoteRepository->getCurrentUserAlertNotifications();
$current_user_notification_count = count($userNoteRepository->getCurrentUserAlertNotifications());
$view->with('current_user_notification', 'current_user_notification_count');
});
thanks in advance
Level 34
@iamamirsalehi I think the problem is on with? it should be:
$view->with([
'current_user_notification' => $current_user_notification,
'current_user_notification_count' => $current_user_notification_count
]);
1 like
Please or to participate in this conversation.