Closed hans0801 closed 1 year ago
Hey @hans0801!
Yes you can get the OU name from a user by using the Distinguished Name builder:
$user = User::findOrFail('cn=John,ou=Users,dc=local,dc=com');
$parentDn = $user->newDn($user->getParentDn());
// "Users"
$name = $parnetDn->name();
// "ou"
$attribute = $parnetDn->head();
Hei @stevebauman , very magic. It's worked like a charm. Thank you so much
Excellent, glad to hear. Happy to help! 👍
Environment:
Hi @stevebauman ,
Here with me again 👯♂️ Just want to ask, is it possible if I need to get the OU name of the users that I sync into my DB? Because when I saw on the AD Users attribute details, there is no OU Name for those users.
Thanks in advance