title: How to check if the user is a guest or logged in at laravel api
body: <p><code>Auth()-&gt;check()</code> keeps returning false. The api is has api middleware only and I want both guests and logged in users to use it.</p>
  
  <p>I tried taking the authorization token from the request header, but I don't know of any way to check which user has this token.</p>
  
  <pre class="lang-php prettyprint-override"><code>if(Auth()-&gt;check()){
          //return extra data
  } else {
          //return something else
  }
  </code></pre>
  
  <p>Why is <code>Auth()-&gt;check()</code> is always returning false even though Ive bearer token inside the header?? It should return true if the header has a token</p>