public function test_Should_SetAndGetSmtpEncryption() { $mailSettingEntity = new MailSettingEntity(); $mailSettingEntity->setSmtpEncryption('tls'); $smtpEncryption = $mailSettingEntity->getSmtpEncryption(); $this->assertEquals('tls', $smtpEncryption); }
/** * Get a model by setting type. If a model does not exist, create a new model. * * @param string $id Setting type * @return \Illuminate\Database\Eloquent\Model */ public function byType($type) { $setting = $this->model->where('type', $type)->first(); if (!is_null($setting)) { return $setting; } if ($type === 'mail') { $attributes = new MailSettingEntity(); $attributes->setDriver('smtp'); $attributes->setFrom(['address' => '*****@*****.**', 'name' => 'Webloyer']); $attributes->setSmtpHost('smtp.mailgun.org'); $attributes->setSmtpPort(587); $attributes->setSmtpEncryption('tls'); $attributes->setSendmailPath('/usr/sbin/sendmail -bs'); } return $this->model->create(['type' => $type, 'attributes' => $attributes]); }