I'm using mcamara/laravel-localization. I need to get languages from db instead of laravellocalization config file. Any ideas how to do that. I would be so grateful.
Asked
Active
Viewed 353 times
1 Answers
1
Your best option is to use the laravel translation loader:
Install Laravel translation loader through Composer:
composer require spatie/laravel-translation-loader
Then publish Laravel translation loader migration file:
php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="migrations"
Finally, run the migrations; it will create a new table called language_lines in the database:
php artisan migrate
UPDATE: for laravel 6+ see the Issue @ github
source: Laravel news

Madan Sapkota
- 25,047
- 11
- 113
- 117

emekamba
- 188
- 9
-
I tried to install, but got and error ` Symfony\Component\Debug\Exception\FatalThrowableError : Class name must be a valid object or a string ` – Mikayel Mar 26 '20 at 12:49
-
What version of laravel are you using? – emekamba Mar 26 '20 at 12:58
-
I'm using laravel 6.2 – Mikayel Mar 26 '20 at 13:09
-
try running composer dump-autoload...The issue is with laravel 6 here is the issue: https://github.com/spatie/laravel-medialibrary/issues/1567 – emekamba Mar 26 '20 at 13:56
-
Ok, that works. Now I have an empty table. What's next. – Mikayel Mar 26 '20 at 14:13
-
Nice to hear it works see the link: https://github.com/spatie/laravel-translation-loader – emekamba Mar 26 '20 at 14:39