Closed grunk closed 2 years ago
Hi @grunk,
You're looking for the findByOrFail()
method. The findOrFail()
method only accepts a distinguished name (hence the invalid DN syntax
error):
https://ldaprecord.com/docs/core/v2/searching-api/#findbyorfail
$query = $connection->query();
try {
$entry = $query->findByOrFail('samaccountname', 'johndoe');
} catch (\LdapRecord\Models\ModelNotFoundException $ex) {
// Not found.
}
Environment:
Describe the bug: Using User::findOrFail() throw an error while using User::where() works fine
Example :
throws :
While
Return "ok" as expected
Configuration is very basic :