<?php

namespace App\Helpers;

use App\Models\EmailConfiguration;

class MailHelper
{

    public static function setMailConfig(){

        $email_setting=EmailConfiguration::first();

        $mailConfig = [
            'transport' => 'smtp',
            'host' => $email_setting->mail_host,
            'port' => $email_setting->mail_port,
            'encryption' => $email_setting->mail_encryption,
            'username' => $email_setting->smtp_username,
            'password' =>$email_setting->smtp_password,
            'timeout' => null
        ];

        config(['mail.mailers.smtp' => $mailConfig]);
        config(['mail.from.address' => $email_setting->email]);
    }
}
