username = $params['username']; $merchant->password = $params['password']; $merchant->email = $params['email'] ?: ''; $merchant->mobile = $params['mobile'] ?: ''; $merchant->register_at = date('Y-m-d H:i:s'); $merchant->register_ip = $params['ip'] ?: ''; $merchant->status = Merchant::STATUS_ACTIVE; $merchant->save(); return $merchant; } }