taylornetwork/laravel-username-generator

Assignment error

ppelgrims opened this issue · 1 comments

Hey Samuel

I get a duplicate key error when I try to add a unique index to my username column, and there are indeed duplicate values.

I reckon there is an assignment error in Generator.php right here: https://github.com/taylornetwork/laravel-username-generator/blob/master/src/Generator.php#L132

You assign the outcome of the comparison instead of the actual count, adding brackets would solve this:

if(($similar = count($this->model->findSimilarUsernames($this->username))) > 0) {

I'd write a PR but it's such a small fix, could you do this? Thank you for this package and thanks in advance.

Warm regards

Pieter

Thanks for the catch and the solution. I added your fix it in v1.1.3