Closed asbiin closed 4 years ago
I've tried to reproduce this, but never got an error. I think if you change cache driver to "database", you should be sure that table exists:
php artisan cache:table
Note: It will create the cache table migration, if you already run it before, you shouldnt do now.
and then run:
php artisan migrate
It's reproductable:
composer global require laravel/installer
laravel new blog
php artisan cache:table
composer require vluzrmos/language-detector
and configure itCACHE_DRIVER=database
and LANG_DETECTOR_LANGUAGES="auto"
in .env
filephp artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1 no such table: cache (SQL: select * from "cache" where "key" = laravel_cachelang-detector.supported-languages limit 1)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
1 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Vluzrmos\LanguageDetector\Providers\LanguageDetectorServiceProvider))
+25 vendor frames
27 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Vluzrmos\LanguageDetector\Providers\LanguageDetectorServiceProvider))
Hello. When using
LANG_DETECTOR_LANGUAGES = 'auto'
, orlang-detector.languages = 'auto'
, values of langs are saved in cache. That's very good! This is the case on bootstrap too, especially when database is not ready yet.Or, if the cache is set to
database
- see https://laravel.com/docs/5.6/cache#driver-prerequisites - the cache table is created on migration process, i.e.php artisan migrate
.Thus, when we combine
cache.default = database
andlang-detector.languages = auto
, migration database create this issue:This happens on
php artisan migrate
orphp artisan cache:table
.Thank you