Support the ongoing development of Laravel.io →
Configuration Architecture
Last updated 1 year ago.
0

I think that is a bed solution, because reading the database is slower then read file system, and you would read it in every request beside selects for getting the data, so it's dramatically encumber database server so I didn't recommended that.

0

It depends I guess ...

To get around hitting the database you could save your query to cache.

Example code:

			$languages = Cache::rememberForever('languages', function() {
				return DB::table('locales')
					->where('active', '=', 1)
					->get();
			});

To prevent warmup lag you could call that function every time you update/write to the database.

I am doing this for a menu package.

0

Sign in to participate in this thread!

JetBrains

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.