firstCredentialKey($credentials), 'password'))) { return; } // First we will add each credential element to the query as a where clause. // Then we can execute the query and, if we found a user, return it in a // Eloquent Front "model" that will be utilized by the Guard instances. $query = $this->newModelQuery(); $userModel = $this->createModel(); foreach ($credentials as $key => $value) { if (Str::contains($key, 'password')) { continue; } logger($key . " : " . $value); if (Str::contains($key, ['email','phone','name'])) { $query->whereCrypt($key, $value); } else if ($value instanceof EncryptFixed) { $query->whereCrypt($key, $value); } else if (is_array($value) || $value instanceof Arrayable) { $query->whereIn($key, $value); } else { $query->where($key, $value); } } return $query->first(); } }