user(); if (!$user) { abort(401, 'Unauthenticated.'); } // Check if user has Executive role or type $isExecutive = false; if (method_exists($user, 'hasRole') && $user->hasRole(['Executive', 'executive', 'Super Admin', 'company admin', 'company'])) { $isExecutive = true; } elseif (isset($user->type) && in_array(strtolower($user->type), ['executive', 'super admin', 'company admin', 'company'])) { $isExecutive = true; } elseif (isset($user->role) && in_array(strtolower($user->role), ['executive', 'super admin', 'company admin', 'company'])) { $isExecutive = true; } if (!$isExecutive) { abort(403, 'Unauthorized access. Only Executive roles can manage paid subdomain inquiries and tenant provisioning.'); } return $next($request); } }