C
C
Curgun2018-09-11 06:23:11
Laravel
Curgun, 2018-09-11 06:23:11

Options from the database to the global array for accessibility anywhere in the application. How to implement this?

Hello. For example, there is a table in the database of the form id|setting_name|setting_value - where the basic settings of the application are stored, for example, the global title, API keys, etc.
What is the best way to implement the ability to reach the setting at any point in the application, for example, through the setting['option_name'] array or the setting('option_name') method?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-09-11
@Curgun

There are a lot of ready-made solutions:
anlutro/laravel-settings
If you don't want to take a ready-made one, you can look at the implementation principle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question