src/Gravatar.php
public function getAvatar($user, $options = [])
    {
        if (!isset($options['size'])) {
            $options['size'] = 100;
        }

        if (!isset($options['secure'])) {
            $options['secure'] = true;
        }

        try {
            if (method_exists('getEmail', $user)) {
                $email = $user->getEmail();
            } elseif (isset($user->email)) {
                $email = $user->email;
            } elseif (isset($user['email'])) {
                $email = $user['email'];
            }

            $hash = $this->getHash($email);

            if ($options['secure']) {
                $avatar_url = $this->https_url . $hash . '?s=' . $options['size'];
            } else {
                $avatar_url = $this->http_url . $hash . '?s=' . $options['size'];
            }

            return $avatar_url;
        } catch(Exception $e) {
            return false;
        }
    }
public function getAvatar($user, $options = [])
    {
        if (!isset($options['size'])) {
            $options['size'] = 100;
        }

        if (!isset($options['secure'])) {
            $options['secure'] = true;
        }

        try {
            if (method_exists('getEmail', $user)) {
                $email = $user->getEmail();
            } elseif (isset($user->email)) {
                $email = $user->email;
            } elseif (isset($user['email'])) {
                $email = $user['email'];
            }

            $hash = $this->getHash($email);

            if ($options['secure']) {
                $avatar_url = $this->https_url . $hash . '?s=' . $options['size'];
            } else {
                $avatar_url = $this->http_url . $hash . '?s=' . $options['size'];
            }

            return $avatar_url;
        } catch(Exception $e) {
            return false;
        }
    }
public function getAvatar ( $ user , $ options = [ ] ) { if ( ! isset ( $ options [ 'size' ] ) ) { $ options [ 'size' ] = 100 ; } if ( ! isset ( $ options [ 'secure' ] ) ) { $ options [ 'secure' ] = true ; } try { if ( method_exists ( 'getEmail' , $ user ) ) { $ email = $ user -> getEmail ( ) ; } elseif ( isset ( $ user -> email ) ) { $ email = $ user -> email ; } elseif ( isset ( $ user [ 'email' ] ) ) { $ email = $ user [ 'email' ] ; } $ hash = $ this -> getHash ( $ email ) ; if ( $ options [ 'secure' ] ) { $ avatar_url = $ this -> https_url . $ hash . '?s=' . $ options [ 'size' ] ; } else { $ avatar_url = $ this -> http_url . $ hash . '?s=' . $ options [ 'size' ] ; } return $ avatar_url ; } catch ( Exception $ e ) { return false ; } }
Retrieves a users gravatar using their email address

@param mixed $user    Accepts a laravel user object, an array or a php object.
@param array $options Check readme for full options.

@return bool|string
Retrieves a users gravatar using their email address