Dynamic Email Configuration from database in Laravel

Good evening, I just fetch my mail configuration from database to provider,
the code was like this,

    if(Schema::hasTable('email_settings')){
            
                $configuration = email_setting::first();

                if(!is_null($configuration)) {
                   $mail =  config::set('mail', [
            'driver' => $configuration->mailer,
            'host' => $configuration->host,
            'port' => $configuration->port,
            'encryption' =>  $configuration->encryption,
            'username' =>$configuration->username,
            'password' => $configuration->password,
                        'from' => [
        'address' => $configuration->sender,
        'name' => $configuration->name,
    ],
                       'pretent' => false,
                       'sendmail' => '/usr/sbin/sendmail -t -i',
                    ]);
                    
                }
        }

This work perfectly when using mailtrap.io but on live server, i always get an error which says “)” not expected. And in my laravel log i always get it as

[2022-06-18 11:46:54] local.ERROR: syntax error, unexpected token ")" {"exception":"[object] (ParseError(code: 0): syntax error, unexpected token ")" at /home/meetclan/delyninvoice/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php:68)

```.
Please can anyone help me with the solution to this error.