title: Call to undefined method stdClass:: Laravel 5.3
body: <p>I´m having this error when i call my method in blade.</p>
  
  <p>My Model</p>
  
  <pre><code>class User extends Authenticatable{
  use Notifiable;
  
  public function roles(){
      return $this-&gt;belongsToMany('App\Role', 'user_roles', 'user_id', 'role_id');
  }
  
  public function hasAnyRole(){
      if(is_array($roles)){
          foreach ($$roles as $role) {
              if($this-&gt;hasRole($role)){
                  return true;
              }
          }
      }else{
          if($this-&gt;hasRole($roles)){
              return true;
          }
      }
      return false;
  }
  
  public function hasRole($role){
      if($this-&gt;roles()-&gt;where("name", $role)-&gt;first())
          return true;
      else
          return false;
  }}
  </code></pre>
  
  <p>Then in my home.blade.php</p>
  
  <pre><code>@foreach($users as $user)
              {{ $user-&gt;hasRole("Admin") }}
              &lt;tr&gt;
                  &lt;form action="{{ route("admin.assignrole") }}" method="get" accept-charset="utf-8"&gt;
                  {{ csrf_field() }}
                  &lt;td&gt;{{ $user-&gt;name }}&lt;/td&gt;
                  &lt;td&gt;{{ $user-&gt;email }}&lt;/td&gt;
                  &lt;td&gt;&lt;input type="checkbox" name="admin" value="admin"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="checkbox" name="cultura" value="cultura"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="checkbox" name="opinion" value="opinion"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;button type="button" class="btn btn-primary"&gt;Asignar&lt;/button&gt;&lt;/td&gt;
                  &lt;/form&gt;
              &lt;/tr&gt;
          @endforeach
  </code></pre>
  
  <p>But i´m getting: 
  "FatalErrorException in 4ec2afb0bd7b9558404eeeb89a6d9200e0c5639a.php line 18:
  Call to undefined method stdClass::hasRole()"</p>
  
  <p>I cant figure why;</p>