I'm trying to update env variables with Config::set
and its working when I run it on my controller but when I move the code into a subfolder it doesn't work. The path i'm moving it to is app\sub_folder1\sub_folder2\MyFile.php
I tried creating a ConfigServiceProvider with the code below but not sure if that's even correct. How can I update the env variables?
public function boot()
{
config([
'app/sub_folder1/sub_folder2/MyFile.php',
]);
}
This is the code that works on my controller.
\Config::set('mail.driver', "smtp");
\Config::set('mail.host', "smtp.gmail.com");
\Config::set('mail.port', "465");
\Config::set('mail.encryption', 'SSL');
\Config::set('mail.username', "xxx@gmail.com");
\Config::set('mail.password', 'xxxxxx');
$from_email = "from@gmail.com";
$to_email = "to@gmail.com";
$subject = "my subject";
$body = "body12345";
\Mail::send('emails.test', ['body'=>$body],function ($message) use($from_email,$to_email,$subject) {
$message->from($from_email);
$message->to($to_email);
$message->subject($subject);
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire