本文整理汇总了PHP中Subscriber::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::create方法的具体用法?PHP Subscriber::create怎么用?PHP Subscriber::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 30) as $index) {
$created = $faker->dateTimeThisYear;
Subscriber::create(array('subscriberName' => $faker->name, 'subscriberEmail' => $faker->email, 'created_at' => $created));
}
}
示例2: doApplySubscriber
public function doApplySubscriber()
{
$validator = Validator::make(array('email' => trim(Input::get('email'))), array('email' => 'required|email|min:6|max:32'));
if ($validator->fails()) {
return Response::json(array('status' => false));
}
$existed = Subscriber::where('email', trim(Input::get('email')))->first();
if ($existed) {
return Response::json(array('status' => false, 'exist' => true));
}
Subscriber::create(array('email' => trim(Input::get('email'))));
return Response::json(array('status' => true));
}
示例3: postSelfRegister
public function postSelfRegister()
{
$input = Input::only('uname', 'pword', 'pword_confirmation', 'status', 'fname', 'lname', 'email', 'address', 'contact');
$rules = Config::get('validations.accounts');
$rules['uname'][] = 'unique:user_accounts';
$rules['pword'][] = 'confirmed';
$v = Validator::make($input, $rules);
$v->setAttributeNames(Config::get('attributes.accounts'));
if ($v->fails()) {
return Redirect::back()->withInput()->withErrors($v);
}
$input['plan_type'] = PREPAID_PLAN;
$input['clear_pword'] = $input['pword'];
$input['pword'] = Hash::make($input['pword']);
$input['is_admin'] = 0;
if (Subscriber::create($input)) {
Session::flash('success', 'succeed');
}
return Redirect::back();
}
示例4: postAdd
public function postAdd()
{
try {
$input = Input::all();
$rules = Config::get('validations.accounts');
$rules['uname'][] = 'unique:user_accounts';
$v = Validator::make($input, $rules);
$v->setAttributeNames(Config::get('attributes.accounts'));
if ($v->fails()) {
return Redirect::back()->withInput()->withErrors($v);
}
$input['clear_pword'] = $input['pword'];
$input['pword'] = Hash::make($input['pword']);
$input['plan_type'] = PREPAID_PLAN;
$account = Subscriber::create($input);
$this->notifySuccess("New Subscriber added successfully: <b>{$input['uname']}</b>");
} catch (Exception $e) {
$this->notifyError($e->getMessage());
return Redirect::route(self::HOME);
}
return Redirect::route(self::HOME);
}
示例5: pre_process
//.........这里部分代码省略.........
$this->validationErrors = true;
}
}
/* subscr_help_email */
/* don't continue, if data was stripped due to the field
* sanitation */
if ($this->validationErrors) {
return;
}
switch (htmlentities($_POST['subscriber'])) {
case 'edit':
$subscriber = null;
if ($this->person->getSubscriber()->hasDBID($id)) {
$subscriber = $this->person->getSubscriber();
} else {
/* Other subscruber than user's
* subscriber, must create new object
* from DB */
$subscriber = Subscriber::getSubscriberByID($id, $this->person->getNREN());
}
if (!is_null($subscriber)) {
/* subscriber will clean input */
$update = $subscriber->setState($state);
$update |= $subscriber->setEmail($this->form_data['subscr_email']);
$update |= $subscriber->setPhone($this->form_data['subscr_phone']);
$update |= $subscriber->setRespName($this->form_data['subscr_responsible_name']);
$update |= $subscriber->setRespEmail($this->form_data['subscr_responsible_email']);
$update |= $subscriber->setComment($this->form_data['subscr_comment']);
$update |= $subscriber->setHelpURL($this->form_data['subscr_help_url']);
$update |= $subscriber->setHelpEmail($this->form_data['subscr_help_email']);
if ($update) {
if (!$subscriber->save(true)) {
Framework::error_output($this->translateTag('l10n_fail_editsubs1', 'nrenadmin'));
} else {
Framework::success_output($this->translateTag('l10n_suc_editsubs1', 'nrenadmin'));
}
}
/* show info-list for subscriber */
$this->tpl->assign('subscr_details', Subscriber::getSubscriberByID($id, $this->person->GetNREN())->getInfo());
$this->tpl->assign('subscriber_details', true);
$this->tpl->assign('subscriber_detail_id', $id);
}
break;
case 'editState':
$subscriber = null;
if ($this->person->getSubscriber()->hasDBID($id)) {
$subscriber = $this->person->getSubscriber();
} else {
$subscriber = Subscriber::getSubscriberByID($id, $this->person->getNREN());
}
if (!is_null($subscriber)) {
if ($subscriber->setState($state)) {
if (!$subscriber->save(true)) {
Framework::error_output("Could not update state of subscriber. Is the database-layer broken?");
Framework::error_output($this->translateTag("l10n_fail_edit_subscr_state", "nrenadmin"));
}
}
}
break;
case 'info':
$this->tpl->assign('subscr_details', Subscriber::getSubscriberByID($id, $this->person->getNREN())->getInfo());
$this->tpl->assign('subscriber_details', true);
$this->tpl->assign('subscriber_detail_id', $id);
break;
case 'add':
if (!isset($this->form_data['db_name'])) {
break;
}
$inheritUIDAttr = isset($_POST['inherit_uid_attr']);
$subscriber = new Subscriber($this->form_data['db_name'], $this->person->getNREN());
if ($subscriber->isValid()) {
Framework::error_output("Cannot create new, already existing.");
break;
}
$update = $subscriber->setState($state);
$update |= $subscriber->setOrgName($this->form_data['dn_name']);
$update |= $subscriber->setEmail($this->form_data['subscr_email']);
$update |= $subscriber->setPhone($this->form_data['subscr_phone']);
$update |= $subscriber->setRespName($this->form_data['subscr_responsible_name']);
$update |= $subscriber->setRespEmail($this->form_data['subscr_responsible_email']);
$update |= $subscriber->setComment($this->form_data['subscr_comment']);
$update |= $subscriber->setHelpURL($this->form_data['subscr_help_url']);
$update |= $subscriber->setHelpEmail($this->form_data['subscr_help_email']);
if ($update && $subscriber->create()) {
Framework::success_output($this->translateTag('l10n_suc_addsubs1', 'nrenadmin') . " " . htmlentities($dn_name, ENT_COMPAT, "UTF-8") . " " . $this->translateTag('l10n_suc_addsubs2', 'nrenadmin'));
}
if (!$inheritUIDAttr) {
$nren = $this->person->getNREN();
$nrenMap = $nren->getMap();
$uidAttr = Input::sanitizeAlpha($_POST['uid_attr']);
$subscriber->saveMap($uidAttr, $nrenMap['cn'], $nrenMap['mail']);
}
break;
case 'delete':
$this->delSubscriber($id);
break;
}
}
/* isset($_POST['subscriber'] */
}
示例6: elseif
} elseif (isset($_POST['add_subscriber']) && $error_txt == "") {
// no error process form
$firstname = $_POST['firstname'];
$callerid = $_POST['callerid'];
$location = $_POST['location'];
// get internal prefix
$site = new Configuration();
$info = $site->getSite();
$internalprefix = $info->postcode . $info->pbxcode;
$new_num = "{$internalprefix}{$callerid}";
echo "<center>";
$amount = 0;
$sub = new Subscriber();
try {
$sub->set("", $callerid, $firstname, 1, $amount, "", "", $location);
$ret = $sub->create();
echo "<img src='img/true.png' width='200' height='170' /><br/><br/>";
if ($ret != "") {
echo "<span style='font-size: 20px;'>" . _("Subscriber already exists! New subscriber number") . ": <b>{$ret}</b> " . _("Successfully provisioned with an initial balance of") . " {$amount}<br/><br/>";
} else {
echo "<span style='font-size: 20px;'>" . _("Subscriber number") . ": <b>{$callerid}</b> " . _("Successfully provisioned with an initial balance of") . " {$amount}<br/><br/>";
}
echo "<a href='provisioning.php'><button class='b1'>" . _("Go Back") . "</button></a>";
} catch (SubscriberException $e) {
echo "<img src='img/false.png' width='200' height='170' /><br/><br/>";
echo "<span style='font-size: 20px; color: red;'>" . _("ERROR PROVISIONING SUBSCRIBER!") . " </span><br/>" . $e->getMessage() . "<br/><br/><br/>";
echo "<a href='provisioning.php'><button class='b1'>" . _("Go Back") . "</button></a>";
}
echo "</center>";
} else {
print_form(0, '');