title: Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#03 (truncated
body: <p>I've created an API using Laravel v5.8.
  This API has one endpoint that recieve some parameters and create 1 row on a database table.
  When I call to this endpoint using Postman, it works.</p>
  <p>But...
  I've create an App using Laravel 5.8 and when this app try to call to that API endpoint sending the same parameters, and headers, this error is showed:</p>
  <p><strong>&quot;Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#03 (truncated...&quot;</strong></p>
  <p>That table should be 'api_log', but i can't see this name in the error message.</p>
  <p><strong>NOTE</strong>: this error happens in the local environment only.</p>
  <p>The Laravel app is using GuzzleHttp to call to the API.</p>
  <p><strong>APP request:</strong></p>
  <pre><code>$client = new \GuzzleHttp\Client();
  $res = $client-&gt;request('POST', 'http://project.local/v1/api_log', [
  'headers' =&gt; [
  'Content-Type' =&gt; 'application/x-www-form-urlencoded',
  'Authorization' =&gt; $_ENV['API_TOKEN']
  ],
  'form_params' =&gt; [
  'json' =&gt; $json_request
  ]
  ]);
  </code></pre>
  <p><strong>MySQL statement in API controller</strong> (no model is used):</p>
  <pre><code>$sql = &quot;INSERT INTO api_log (user_id, environment, start_datetime, end_datetime, requested_api, processing_time, activity_id, ip_address, request_data, response_data, credits) VALUES (&quot;.$user_id.&quot;,'&quot;.$env.&quot;','&quot;.$start_datetime.&quot;','&quot;.$end_datetime.&quot;',&quot;.$requested_api.&quot;,&quot;.$processing_time.&quot;,'&quot;.$activity_id.&quot;','&quot;.$ip_address.&quot;','&quot;.$request_data.&quot;','&quot;.$response_data.&quot;',&quot;.$credits.&quot;)&quot;;            
  
  $insert_log = DB::connection('mysql_log')-&gt;statement($sql);
  </code></pre>
  <p>I've already tried to use a model like this but it didn't work:</p>
  <pre><code>class ApiLog extends Model
  {
      protected $connection = 'mysql_log';
      protected $table = 'api_log';
  }
  </code></pre>
  <p>I'm using normal http://localhost/... domains for the API and APP.
  I've tried wrapping the API into a virtual host like <a href="http://project.local" rel="nofollow noreferrer">http://project.local</a> but the same error is showed.</p>
  <p>Some clue? Thanks.</p>