Laravel 5.4 - get translations from database instead of lang files
I need to keep my translations in a database. I have created a model with group, key and value and filled the database with all the values i currently have in my lang files. Now i wish to make the switch so if trans('group.key') or @lang('group.key') is called from my code i want it to get the value from database, not the lang file. How is it possible to achieve this?
PS. I looked through some of the available plugins that do something similar, but they dont quite fit me because i have my own complex models.
Yes, the backend users need to be able to add languages and translate the whole page to a new language. Giving them lang files in php array format would cause chaos i think. Its even hard to keep them in sync myself when i have 3 languages.
One thing im concidering at the moment is to generate language files on each change (or if it turns out to be too heavy an operation then make a seperate button for users to propagae language change). This way I wont have to worry about how to hijack laravels native translator and also i wont need to make db querys and caching for each user.