Inheritance: extends App\Entities\Setting\AbstractSettingEntity
Example #1
0
 public function test_Should_SetAndGetSendmailPath()
 {
     $mailSettingEntity = new MailSettingEntity();
     $mailSettingEntity->setSendmailPath('/usr/sbin/sendmail -bs');
     $sendmailPath = $mailSettingEntity->getSendmailPath();
     $this->assertEquals('/usr/sbin/sendmail -bs', $sendmailPath);
 }
Example #2
0
 public function all()
 {
     $driver = $this->reader->getConfig('MAIL_DRIVER');
     $fromAddress = $this->reader->getConfig('MAIL_FROM_ADDRESS');
     $fromName = $this->reader->getConfig('MAIL_FROM_NAME');
     $smtpHost = $this->reader->getConfig('MAIL_HOST');
     $smtpPort = $this->reader->getConfig('MAIL_PORT');
     $smtpEncryption = $this->reader->getConfig('MAIL_ENCRYPTION');
     $smtpUsername = $this->reader->getConfig('MAIL_USERNAME');
     $smtpPassword = $this->reader->getConfig('MAIL_PASSWORD');
     $sendmailPath = $this->reader->getConfig('MAIL_SENDMAIL');
     $from = ['address' => $fromAddress, 'name' => $fromName];
     $mailSetting = new MailSettingEntity();
     $mailSetting->setDriver($driver)->setFrom($from)->setSmtpHost($smtpHost)->setSmtpPort($smtpPort)->setSmtpEncryption($smtpEncryption)->setSmtpUsername($smtpUsername)->setSmtpPassword($smtpPassword)->setSendmailPath($sendmailPath);
     return $mailSetting;
 }
Example #3
0
 /**
  * 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]);
 }