danrovito / Laravel-Gravatar by danrovito

Uses the authorized users email to display their Gravatar as an image
133
8
1
Package Data
Maintainer Username: danrovito
Maintainer Contact: hello@danrovito.com (Dan Rovito)
Package Create Date: 2015-09-08
Package Last Update: 2017-09-26
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:08:56
Package Statistics
Total Downloads: 133
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 8
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Laravel Gravatar

Latest Stable Version Total Downloads License StyleCI

Laravel Gravatar is a simple Laravel package that displays a registered users Gravatar based on their email address in your users table. If the user does not have a registered gravatar it will show the default mystery man.

Mystery Man

Installation

Via Composer

composer require danrovito/laravel-gravatar

Usage

Use Gravatar in your User model.

<?php

namespace App;

use Darovi\Gravatar;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
  use Gravatar;
 
  // ...
}

You can also control what attribute should be treated as the email address (instead of email) by overriding the emailAttributeName() method:

<?php

namespace App;

use Darovi\Gravatar;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
  use Gravatar;
  
  protected function emailAttributeName()
  {
    return 'your_email_column';
  }
  
  // ...
}

Then in your view wherever you want to use the Gravatar

<img src="{{ Auth::user()->gravatar }}">

License

Laravel Slack Invite is open-sourced software licensed under the MIT license

Bug Reporting and Feature Requests

Please add as many details as possible regarding submission of issues and feature requests

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.