I want put my MAILGUN_SECREY and others keys in database,
I have a model for variables and I access it like this:
\App\Variable::getByClave('MAILGUN_SECRET')->pluck('valor')->first();
what would be the correct way to update the .env or overwrite it from DDBB?
Thx :)
My Answer:
It is not recommended to save sensitive information such as API keys or secrets in a database, as it can pose a security risk. It is best practice to store such sensitive information in a secure location such as a .env file.
If you want to access these variables in your Laravel application, you can store them in your .env file and access them using the `env()` helper function. For example, in your .env file:
MAILGUN_SECRET=your_mailgun_secret_key_here
And in your code, you can access it like this:
$mailgunSecret = env('MAILGUN_SECRET');
This way, you can keep your sensitive information secure and easily accessible in your Laravel application.
Rate this post
5 of 5 based on 6509 votesComments