title: Call to undefined relationship [users] on model [App\Team] laravel 6
body: <p>Hey i am pretty new in coding and laravel.I am trying to build an app here i think i messed it up but cant find a way around it.I am getting Call to undefined relationship [users] on model [App\Team] exception . I have two tables with many to many relationship . I want to show in the view "viewteams.blade.php" the teams that a user belongs to.</p>
  
  <p>My User model </p>
  
  <pre><code>    public function users(){
        return $this-&gt;belongsToMany(Team::class);
      }
  </code></pre>
  
  <p>My team model</p>
  
  <pre><code>  public function teams(){
      return $this-&gt;belongsToMany(User::class);
    }
  </code></pre>
  
  <p>my Route</p>
  
  <pre><code>Route::get('/viewteams','ViewTeamController@index');
  </code></pre>
  
  <p>my ViewTeamController </p>
  
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Team;
  use App\User;
  
  class ViewTeamController extends Controller
  {
      public function index()
      {
        $teams = Team::all()-&gt;load('users');
        return view('teams.viewteams',compact('teams'));
      }
  }
  </code></pre>
  
  <p>my viewteams.blade.php</p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row justify-content-center"&gt;
          &lt;div class="col-md-8"&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-header"&gt;&lt;h2 style="text-align:center;"&gt;Your Teams&lt;/h2&gt;&lt;/div&gt;
                  @foreach ($teams as $team)
                    @foreach($team-&gt;users as $user)
                      {{$user-&gt;org_name}}
                      @endforeach
                  @endforeach
  
                  &lt;div class="card-body"&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>