title: Laravel Passport API: createToken get id
body: <h1>Situation</h1>
  
  <p>I'm using Laravel Passport API to communicate between Laravel and external "agents" via Personal Access Tokens: <a href="https://laravel.com/docs/5.5/passport#personal-access-tokens" rel="nofollow noreferrer">https://laravel.com/docs/5.5/passport#personal-access-tokens</a></p>
  
  <p>You can create tokens: via <code>$token = \Auth::user()-&gt;createToken('name')-&gt;accessToken;</code></p>
  
  <p>($token then holds only the token itself, not the object)</p>
  
  <h1>Question</h1>
  
  <p>How can I get the <code>token()-&gt;id</code> for a newly created token?</p>
  
  <h1>Background</h1>
  
  <p>I need to get the ID to store it in the database to make relation to other table.</p>