mavinoo / laravelBatch

insert batch and update batch in laravel
MIT License
564 stars 118 forks source link

Determine database driver from model #105

Closed bleepblorb closed 10 months ago

bleepblorb commented 10 months ago

The current implementation determines the database driver from the default database configuration file. This can cause issues when a model uses a database that is different from the default. This pull request fixes this by determining the driver based on the model configuration, using methods built into the framework.

$driver = $table->getConnection()->getDriverName();

I believe this to be a fix that brings it into alignment with expectations, but there's a slim chance it could cause breaking changes if people were relying on the existing behavior.

I was unable to get the tests running on a fresh Laravel project and therefore did not check existing tests or add an additional test for this use case. In practice, it was working for me though.