This change does two things in Drivers\Database::getTranslation():
Caching results for a significant reduction in amount of duplicate queries executed
Handling the case where the database tables don't exist
The case where the database tables don't exist can happen when you install both laravel-translation and some other package in the same Laravel project, and the other project using translations in their service provider's boot method. In that case, when you install the project from scratch, you can't execute php artisan migrate because the other package tries accessing translations before the database can be initialized, and so far we're relying on the database to be set up for us to work. The fix here is to just handle non-existing database tables for translation as "this language doesn't exist in the database", allowing the migrations to run.
This change does two things in
Drivers\Database::getTranslation()
:The case where the database tables don't exist can happen when you install both
laravel-translation
and some other package in the same Laravel project, and the other project using translations in their service provider'sboot
method. In that case, when you install the project from scratch, you can't executephp artisan migrate
because the other package tries accessing translations before the database can be initialized, and so far we're relying on the database to be set up for us to work. The fix here is to just handle non-existing database tables for translation as "this language doesn't exist in the database", allowing the migrations to run.