Getting error when. assign sales owner try to open that particular lead
- 
					
					
					
					
 ErrorException 
 PHP 8.1.29
 10.48.20
 Undefined variable $userIds
- 
					
					
					
					
 Same error here. when the lead it's assigned to user, these user can't open the lead. { $lead = $this->leadRepository->findOrFail($id); if ( $userIds = bouncer()->getAuthorizedUserIds() && ! in_array($lead->user_id, $userIds) ) { return redirect()->route('admin.leads.index'); } return view('admin::leads.view', compact('lead')); 
- 
					
					
					
					
  
- 
					
					
					
					
 I have the same error, too. I'm not sure if it's part of the same problem, but when I try to add a new lead with the non-admin account, I am not able to select the sales owner, so after the lead is created, the person who created it can not see it. In both cases, I guess it's a permitions problem and they need access to something I missed on that user group. 
- 
					
					
					
					
 I have done the following to get it working - not sure if this will break something else but seems to be working so far  in the LeadController.php 
 n the get function
 replace:if ($userIds = bouncer()->getAuthorizedUserIds()) { $query->whereIn('leads.user_id', $userIds); }with: $userIds = bouncer()->getAuthorizedUserIds() ?? []; if (!empty($userIds)) { $query->whereIn('leads.user_id', $userIds); }and in the view function, replace: 
 replaceif ( $userIds = bouncer()->getAuthorizedUserIds() && ! in_array($lead->user_id, $userIds) ) { return redirect()->route('admin.leads.index'); }with $userIds = bouncer()->getAuthorizedUserIds() ?? []; if (!empty($userIds) && !in_array($lead->user_id, $userIds)) { return redirect()->route('admin.leads.index');
- 
					
					
					
					
 GO TO : packages/Webkul/Admin/src/Http/Controllers/Lead/LeadController.php In view function Remove this : if ( 
 $userIds = bouncer()->getAuthorizedUserIds()
 && ! in_array($lead->user_id, $userIds)
 ) {
 return redirect()->route('admin.leads.index');
 }with: $userIds = bouncer()->getAuthorizedUserIds(); if ($userIds && ! in_array($lead->user_id, $userIds)) { 
 return redirect()->route('admin.leads.index');
 }