public function test_Should_SetAndGetFrom() { $mailSettingEntity = new MailSettingEntity(); $from['address'] = '*****@*****.**'; $from['name'] = 'from_name'; $mailSettingEntity->setFrom($from); $retFrom = $mailSettingEntity->getFrom(); $this->assertEquals($from, $retFrom); }
/** * 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]); }