Ejemplo n.º 1
0
 public static function create(\Organization $org)
 {
     $msg = 'Added STMP details!!';
     $search = ['prop' => 'orgSmtp', 'propid' => $org->_id];
     $meta = Meta::first($search);
     if (!$meta) {
         $meta = new Meta($search);
     }
     $fields = ['server', 'username', 'password', 'email', 'from', 'email', 'security', 'port'];
     $value = [];
     foreach ($fields as $key) {
         $v = RequestMethods::post($key);
         if (!$v) {
             return 'Please Fill the Required Fields';
         }
         $value[$key] = $v;
     }
     $value['password'] = Utils::encrypt($value['password'], $org->_id);
     $meta->value = $value;
     if ($meta->validate()) {
         $meta->save();
     } else {
         $msg = 'Fill all required values';
     }
     return $msg;
 }