title: Laravel 5.2 : How to get the role of current user when using `Zizaco/entrust`?
body: <p>I am using Laravel 5.2 and <code>Zizaco/entrust</code> 5.2,my question is:<br>
  How to get the role of current user when using <code>Zizaco/entrust</code>?</p>
  
  <p>NameAndRole.php   </p>
  
  <pre><code>namespace App\Services;
  
  use App\User;
  use App\Role;
  use Zizaco\Entrust\EntrustRole;
  use Illuminate\Support\Facades\Cache;
  
  class NameAndRole
  {
      public $username;
      public $role;
  
      public function __construct() {
          $user = \Auth::user();
          $this-&gt;username = $user-&gt;name;
          $this-&gt;role =$user-&gt;roles-&gt;first()-&gt;name;
      }
  }
  </code></pre>
  
  <p><strong>Models:</strong>   </p>
  
  <p>Role:<a href="https://github.com/Zizaco/entrust#role" rel="nofollow">https://github.com/Zizaco/entrust#role</a></p>
  
  <pre><code>&lt;?php namespace App;
  
  use Zizaco\Entrust\EntrustRole;
  
  class Role extends EntrustRole
  {
  }
  </code></pre>
  
  <p>User:<a href="https://github.com/Zizaco/entrust#user" rel="nofollow">https://github.com/Zizaco/entrust#user</a></p>
  
  <pre><code>&lt;?php
  
  use Zizaco\Entrust\Traits\EntrustUserTrait;
  
  class User extends Eloquent
  {
      use EntrustUserTrait; // add this trait to your user model
  
      ...
  }
  </code></pre>
  
  <p><strong>view:</strong> sidebar.blade.php</p>
  
  <pre><code>@inject('details','App\Services\NameAndRole')
  {{ $details-&gt;username }}
  {{ $details-&gt;role }}
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>ErrorException in NameAndRole.php line 20:
  Trying to get property of non-object (View: D:\wnmp\www\laravel-entrust\resources\views\employer\partials\sidebar.blade.php) (View: D:\wnmp\www\laravel-entrust\resources\views\employer\partials\sidebar.blade.php)
  </code></pre>