Created
August 17, 2024 02:32
-
-
Save abdasis/f7c4a72453f5349a0d7d5d40e5e75605 to your computer and use it in GitHub Desktop.
Membuat config email dengan data dari database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use App\Settings\Smtp; | |
use Config; | |
use Illuminate\Support\ServiceProvider; | |
class MailConfigServiceProvider extends ServiceProvider | |
{ | |
public function register(): void | |
{ | |
} | |
public function boot(Smtp $smtp): void | |
{ | |
$config = array( | |
'driver' => 'smtp', | |
'host' => $smtp->host, | |
'port' => $smtp->port, | |
'from' => array('address' => $smtp->mail_from_address, 'name' => $smtp->mail_from_name), | |
'encryption' => $smtp->encryption, | |
'username' => $smtp->username, | |
'password' => $smtp->password, | |
); | |
Config::set('mail', $config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment