title: I'm getting error in Builder::getAuthIdentifierName() after register in Laravel
body: <p>My application in Laravel is presenting the following error after registering:
  "BadMethodCallException
  Call to undefined method Illuminate\Database\Query\Builder::getAuthIdentifierName()"
  The error only appears after performing the authentication. If I clear my browser's cache, the error disappears and the application works normally.
  I already saw other answers in StackOverflow and other sites, but none of them solved my problem. What could be happening?</p>
  
  <p>Here is my User.php file:</p>
  
  <pre><code>use Laravel\Passport\HasApiTokens;
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  
  class User extends Authenticatable
  {
      use HasApiTokens, Notifiable;
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'cpf', 'name', 'lastname', 'email', 'password', 'auth', 'authy_id', 'api_token', 'block', 'blocked_at', 'session'
      ];
  
      /**
       * The attributes that should be hidden for arrays.
       *
       * @var array
       */
      protected $hidden = [
          'password', 'remember_token',
      ];
  }
  </code></pre>
  
  <p>My code that does authentication is here:</p>
  
  <pre><code>public function auth($session, $gtag){
      $user = User::where('session', $session)-&gt;first();
      if(isset($user) &amp;&amp; !empty($user)){
          Auth::login($user);
  
          //$time = decrypt($user-&gt;session);
          $user-&gt;session = NULL;
          $user-&gt;save();
  
          setcookie('_ga', $gtag, (time() + 605800), '/', 'bmydomain.com');
          setcookie('_gat_gtag_UA_115432851_1', '1', (time() + 605800), '/', 'mydomain.com');
  
          return redirect($this-&gt;redirectTo);
      }
      else{
          return redirect($this-&gt;redirectNotAuth);
      }
  }
  </code></pre>