Well ... I had an error in the email address in the .env file. Probably very tired ;) ...
Jun 5, 2022
1
Level 63
Where clause does not work with config() data
Hello,
I have a environment variable NOTIFICATIONS_MAIL. I have a configuration file in which I retrieve the notifications mail.
'notifications' => [
'email' => env('NOTIFICATIONS_MAIL'),
],
I retrieve the email in my controller : $email = config('nathan.notifications.email'). Then I find the user in the database.
$email = config('nathan.notifications.email');
$user = User::where('email', $email)->first();
$user->notify(new BackupDone());
$email contains the right email, but $user is null. I have even tried with a closure in the where clause, but it doesn't work either.
If I write the email directly in the variable $email = '[email protected]';, it works.
Why ?
Do you see anything wrong in my code ?
Thanks for your help.
V
Level 63
Please or to participate in this conversation.