本文整理汇总了PHP中Guardian::setRelationship方法的典型用法代码示例。如果您正苦于以下问题:PHP Guardian::setRelationship方法的具体用法?PHP Guardian::setRelationship怎么用?PHP Guardian::setRelationship使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guardian
的用法示例。
在下文中一共展示了Guardian::setRelationship方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postAdd
public function postAdd()
{
$divisions = DBGNDDivisionController::getAllDivision();
$divisionIdA = array();
foreach ($divisions as $division) {
$divisionIdA[] = $division->getGrama_niladari_div_no();
}
$first_name = Input::get("firstNameText");
$last_name = Input::get("lastNameText");
$email = Input::get("emailText");
$permanent_address = Input::get("addressText");
$password = Input::get("password");
$conform_password = Input::get("confirm_password");
$nic = Input::get("nicText");
$telephone_number = Input::get("telephoneText");
$relation_to_child = Input::get("relationshiptochild");
$religion = Input::get("religionText");
$nationality = Input::get("nationalityText");
$div_val = Input::get("gramaNiladariDivisionNumberText");
$grama_niladry_division_number = $divisionIdA[$div_val];
/*$rules=array('$conform_password' => 'same:$password', );
$validator=Validator::make(Input::all(),$rules);
if($validator->fails())
return Redirect::to('/');*/
if (strcmp($conform_password, $password) != 0) {
return Redirect::to('guardian')->withInput()->with('error', "Passwords dont match");
} elseif (validationhandler::checkNIC($nic) == false) {
return Redirect::to('guardian')->withInput()->with('error', "NIC is invalid");
} elseif (!preg_match("/^[a-zA-Z'-]+\$/", $first_name)) {
return Redirect::to('guardian')->withInput()->with('error', "First Name is invalid");
} elseif (!preg_match("/^[a-zA-Z'-]+\$/", $last_name)) {
return Redirect::to('guardian')->withInput()->with('error', "Last Name is invalid");
} elseif (!preg_match("/^[a-zA-Z'-]+\$/", $religion)) {
return Redirect::to('guardian')->withInput()->with('error', "Religion is invalid");
} elseif (!preg_match("/^[a-zA-Z'-]+\$/", $nationality)) {
return Redirect::to('guardian')->withInput()->with('error', "Nationality is invalid");
} elseif (!preg_match("/^[0]{1}[0-9]{9}\$/", $telephone_number)) {
return Redirect::to('guardian')->withInput()->with('error', "Telephone Number is invalid");
} else {
$guardian = new Guardian();
$guardian->setNic($nic);
$guardian->setFirstName($first_name);
$guardian->setLastName($last_name);
$guardian->setEmail($email);
$guardian->setPermanent_address($permanent_address);
// $guardian->setPassword(Hash::make($password));
$guardian->setPassword($password);
$guardian->setContact_number($telephone_number);
$guardian->setRelationship($relation_to_child);
$guardian->setReligion($religion);
$guardian->setNationality($nationality);
$guardian->setGrama_nil_div_no($grama_niladry_division_number);
$result = DBGuardianController::addGuardian($guardian);
if ($result) {
return View::make('G1SAS/AddGuardianSuccessfull');
} else {
return "not added successfully";
}
}
}
示例2: getGuardianByNic
public static function getGuardianByNic($guardianNic)
{
$db = Connection::getInstance();
$mysqli = $db->getConnection();
$query = "select * from guardian where NIC='{$guardianNic}'";
$result = $mysqli->query($query);
$guardian = new Guardian();
if ($result->num_rows > 0) {
if ($row = $result->fetch_assoc()) {
$guardian->setNic($row["NIC"]);
$guardian->setEmail($row["email"]);
$guardian->setFirstName($row["g_firstName"]);
$guardian->setLastName($row["g_lastName"]);
$guardian->setRelationship($row["relationship"]);
$guardian->setNationality($row["g_nationality"]);
$guardian->setReligion($row["g_religion"]);
$guardian->setPermanent_address($row["permanent_address"]);
$guardian->setEmail($row["email"]);
$guardian->setContact_number($row["contactNumber"]);
$guardian->setGrama_nil_div_no($row["grama_niladari_div_no"]);
$guardian->setPassword($row["password"]);
}
} else {
return NULL;
}
return $guardian;
}