title: Laravel 8: Call to undefined method Model::contains()
body: <p>I'm using Laravel 8 for my project and in this project and I have created a custom Middleware called <code>Admin</code> that goes like this:</p>
  <pre><code>public function handle(Request $request, Closure $next)
  {
      if (Auth::user()-&gt;isAdmin()) {
          return $next($request);
      }
  
      return redirect('/');
  }
  </code></pre>
  <p>And I tried applying it like this:</p>
  <pre><code>Route::middleware('admin')-&gt;group(function () {
     Route::get('test', function () { return &quot;User is authenticated and is an admin.&quot;; });
  });
  </code></pre>
  <p>And on <code>Kernel.php</code> at <code>$middlewareGroups</code> section:</p>
  <pre><code>'admin' =&gt; [
     'auth',
     \App\Http\Middleware\Admin::class
  ],
  </code></pre>
  <p>So I called the <code>isAdmin()</code> at User Model which simply checks if the role of the user is correct or not:</p>
  <pre><code>public function role()
  {
      return $this-&gt;belongsTo(Role::class);
  }
  
  public function isAdmin()
  {
      return $this-&gt;role-&gt;contains('slug', 'super-admin');
  }
  </code></pre>
  <p>But now the problem is, when I go to <code>/test</code> uri, it does not redirect me to <code>('/')</code> uri and shows me this error:</p>
  <p><strong>BadMethodCallException
  Call to undefined method App\Models\Role::contains()</strong></p>
  <p>So what is going wrong here? How can I fix this issue?</p>
  <p>Note that the relationship between <code>roles</code> and <code>users</code> table is One To Many. That's why I wrote <code>role()</code> instead of <code>roles()</code> because each user has only one role.</p>