Description
Store your translations in the database or other sources
You can create a translation in the database by creating and saving an instance of the Spatie\TranslationLoader\LanguageLine-model:
use Spatie\TranslationLoader\LanguageLine; LanguageLine::create([ 'group' => 'validation', 'key' => 'required', 'text' => ['en' => 'This is a required field', 'nl' => 'Dit is een verplicht veld'],]);
You can fetch the translation with Laravel's default __ function:
__('validation.required'); // returns 'This is a required field' app()->setLocale('nl'); __('validation.required'); // returns 'Dit is een verplicht veld'
You can still keep using the default language files as well. If a requested translation is present in both the database and the language files, the database version will be returned.
If you need to store/override JSON translation lines, just create a normal LanguageLine with group => '*'.
Recent Courses on Laravel Daily
[NEW] Marketing for Developers in 2026
7 lessons
52 min
Practical Laravel Security: Packages, Secrets, Supply-Chain Attacks
7 lessons
43 min read
AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)
7 lessons
52 min