I have no idea how to google this since I mostly get tutorials about setting up multiple database connections.
At the moment, completely at random, my Laravel application gives me back an error about SQL, that the table could not be found. Laravel connects in this case to an entitely different database for some reason.
I connect in my .env and config/database.php to database1. Suddenly, an SQL error appears reading
Cannot find table `database2`.`table` in field list.
User also gets logged out when this error occurs.
Might be of use if i include that:
Has anyone come across this problem? And if yes, how do I solve this? Thanks in advance!
Have you defined a model to use a different connection maybe?
Following the Laravel docs, this lets you use a different connection for specific models.
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The connection name for the model.
*
* @var string
*/
protected $connection = 'connection-name';
}