How to use Laravel Passport with a custom username column

You can use findForPassport method in your user model.

This method take username as argument, and return user model

For example:

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

    // ... some code

    public function findForPassport($username) {
        return $this->where('id', $username)->first();
    }
}

A bit too late to answer, but I've been having a hard time trying to figure this out, so for the sake of completeness and to maybe help others in the future.

If you take a look to this part of passport's code you'll see that it also looks for a validateForPassportPasswordGrant method, so in addition to Alexander's answer, that's how you can authenticate an user using custom fields.

Hope it helps someone.