本文整理匯總了PHP中Alert::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Alert::save方法的具體用法?PHP Alert::save怎麽用?PHP Alert::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Alert
的用法示例。
在下文中一共展示了Alert::save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addAlert
public function addAlert()
{
$input = Input::all();
$alert = new Alert();
$alert->value = $input['value'];
$alert->condition = $input['condition'];
$alert->user_id = $input['user'];
$alert->owner_user_id = $input['user'];
$alert->save();
return Redirect::to('/alerts');
}
示例2: Alert
try {
if ($id) {
$alertTable = Doctrine_Core::getTable('Alert');
$result = $alertTable->find($id);
if ($result) {
echo "Found alert " . $result['Id'];
$alert = $result;
$alert['Active'] = $active;
} else {
//TODO: Passed in an Id, but didn't find it. Add error here.
}
} else {
$alert = new Alert();
$alert['Active'] = 0;
}
$alert['AlertFolderId'] = $folderId;
$alert['UserId'] = $user_id;
$alert['Label'] = $label;
$alert['Description'] = $description;
$alert['EmailAddresses'] = $emailaddresses;
$alert['AlertOn'] = $alerton;
$alert['AlertOnType'] = $alertontype;
$alert['AlertOnComparator'] = $alertoncomparator;
$alert['AlertOnValue'] = $alertonvalue;
$alert['AlertThreshold'] = $alertthreshold;
$alert->save();
} catch (Exception $e) {
error_log("[WPTMonitor] Failed while updating alert: for " . $user_id . " message: " . $e->getMessage());
}
header("Location: listAlerts.php");
exit;