title: Call to a member function createToken() on null
body: <p>I am newbie to laravel api and laravel passport,and I know this is an old issue, but no answer helped me.I am using laravel passport for api
  Registration,login working fine, but logout giving and error</p>
  <p><strong>Here Is My Registraion Code</strong></p>
  <pre><code> public function register (Request $request) {
      $validator = Validator::make($request-&gt;all(), [
              'UserName' =&gt; 'required|string|max:255',
              'UserFullName' =&gt; 'string|max:255',
              'UserEmail' =&gt; 'required|string|email|max:255|unique:users',
              'UserPhone' =&gt; 'required|string|max:255|unique:users',
              'Password' =&gt; 'required|string|min:6|confirmed',
          ]);
          if ($validator-&gt;fails())
          {
              return response(['errors'=&gt;$validator-&gt;errors()-&gt;all()], 422);
          }
          if ($request['UserPhone']==Null) { // will check for empty string, null values, see php.net about it
              $request['UserPhone'] = NULL;
          }
          $request['Password']=Hash::make($request['Password']);
          $request['remember_token'] = Str::random(10);
          $request['UserType'] = $request['UserType'] ? $request['UserType']  : 1;
          //return response($request, 200);
          $user = User::create($request-&gt;toArray());
          $token = $user-&gt;createToken('Laravel Password Grant Client')-&gt;accessToken;
          //return response($token, 200);
          $response['data']= $user;
          $response['data']['token'] = $token;
          return response($response, 200);
      }
  </code></pre>
  <p><strong>My Login Code</strong></p>
  <pre><code>    public function login (Request $request) {
          $validator = Validator::make($request-&gt;all(), [
              'UserEmail' =&gt; 'required|string|email|max:255',
              'Password' =&gt; 'required|string|min:6',
          ]);
          if ($validator-&gt;fails())
          {
              return response(['errors'=&gt;$validator-&gt;errors()-&gt;all()], 422);
          }
          $user = User::where('UserEmail', $request-&gt;UserEmail)-&gt;first();
          if ($user) {
              if (Hash::check($request-&gt;Password, $user-&gt;Password)) {
                  $token = $user-&gt;createToken('Laravel Password Grant Client')-&gt;accessToken;
                  $response['data']= $user;
                  $response['data']['token'] = $token;
                  return response($response, 200);
              } else {
                  $response = [&quot;message&quot; =&gt; &quot;Password mismatch&quot;];
                  return response($response, 422);
              }
          } else {
              $response = [&quot;message&quot; =&gt;'User does not exist'];
              return response($response, 422);
          }
      }
  </code></pre>
  <p><strong>My Logout Code</strong></p>
  <pre><code>public function logout (Request $request) {
          //return $request-&gt;Authorization;
          $token = $request-&gt;user()-&gt;token();
          //return $token;
          $token-&gt;revoke();
          $response = ['message' =&gt; 'You have been successfully logged out!'];
          return response($response, 200);
      }
  </code></pre>
  <p><strong>Postman Response</strong></p>
  <pre><code>&quot;message&quot;: &quot;Call to a member function createToken() on null&quot;,
      &quot;exception&quot;: &quot;Error&quot;,
  </code></pre>