I have an API endpoint on domain-1
Route::get('users', [UserApiController::class, 'index'])
and I try to retrieve the data from domain-2. I use the HTTP client to execute a request on the API route.
Http::get('http://www.domain-1/api/users')
But the request sends me back a Base table or view not found: 1146 the table 'domain-2-db.users' does not exists -> trying to find a table on the domain-2 database instead of performing the request on the domain-1-db
I tried hitting the API endpoint
http://www.domain-1/api/users
directly in the browser or with Postman, and I can access the data. I also tried to submit a form from the domain-2, and I retrieve the data.
The error only occurs with the HTTP client.
May be that's pretty obvious, but I can't figure out what's the issue and how to fix it.
Any help appreciated!
Response came from this post https://stackoverflow.com/a/53803441/10309333
The solution was to change the DB_DATABASE const name from the env file