I have created a service provider in my Laravel Application SettingsServiceProvider
. This caches the settings table from the database.
$settings = $
Struggled for 3 days with this issue finally I figured out a way to solve it.
First I created a table mails
and populated it with my values.
Then I created a provider MailConfigServiceProvider.php
first();
if ($mail) //checking if table is not empty
{
$config = array(
'driver' => $mail->driver,
'host' => $mail->host,
'port' => $mail->port,
'from' => array('address' => $mail->from_address, 'name' => $mail->from_name),
'encryption' => $mail->encryption,
'username' => $mail->username,
'password' => $mail->password,
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Config::set('mail', $config);
}
}
}
}
And then registered it in the config\app.php
App\Providers\MailConfigServiceProvider::class,