protected function getUserId($user) : ?int
    {
        if ($user === null) {
            return null;
        }

        if (is_int($user)) {
            return $user;
        }

        if ($user instanceof Authenticatable) {
            return $user->getAuthIdentifier();
        }

        return null;
    }
protected function getUserId($user) : ?int
    {
        if ($user === null) {
            return null;
        }

        if (is_int($user)) {
            return $user;
        }

        if ($user instanceof Authenticatable) {
            return $user->getAuthIdentifier();
        }

        return null;
    }
protected function getUserId ( $ user ) : ? int { if ( $ user === null ) { return null ; } if ( is_int ( $ user ) ) { return $ user ; } if ( $ user instanceof Authenticatable ) { return $ user -> getAuthIdentifier ( ) ; } return null ; }
Get user ID

@param int|\Illuminate\Contracts\Auth\Authenticatable|null $user
@return int|null
Get user ID