本文整理汇总了PHP中Carrier::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Carrier::all方法的具体用法?PHP Carrier::all怎么用?PHP Carrier::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carrier
的用法示例。
在下文中一共展示了Carrier::all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: carrierSignUp
public function carrierSignUp()
{
if (Input::exists("key") || Input::exists("cname") || Input::exists("fname") || Input::exists("lname") || Input::exists("email") || Input::exists("mob")) {
$key = Input::get("key");
$cname = Input::get("cname");
$fname = Input::get("fname");
$lname = Input::get("lname");
$email = Input::get("email");
$mob = Input::get("mob");
if (empty($key) || empty($cname) || empty($fname) || empty($lname) || empty($email) || empty($mob)) {
textMsg("All fields are required", "error");
Redirect::url("home/register");
exit;
} else {
if ($key == $_SESSION['key']) {
$check = Carrier::all(['email' => $email]);
if (count($check) > 0) {
textMsg("This email id already exists try again", "error");
Redirect::url("home/register");
exit;
} else {
$user = new Carrier();
$user->company_name = $cname;
$user->first_name = $fname;
$user->last_name = $lname;
$user->email = $email;
$user->mobile = $mob;
$user->status = 1;
$user->join_date = time();
if ($user->save()) {
textMsg("You have been ragistered succesfully", "success");
Redirect::url("home/register");
exit;
} else {
textMsg("somethis went wrong try again", "error");
Redirect::url("home/register");
exit;
}
}
} else {
textMsg("Unable to do this action", "error");
Redirect::url("home/register");
exit;
}
}
} else {
textMsg("somethis went wrong try again", "error");
Redirect::url("home/register");
exit;
}
}
示例2: deleteCarrier
public function deleteCarrier()
{
isAdminLogin();
if (Input::exists("id")) {
$id = Input::get("id");
if (empty($id)) {
echo json_encode(['result' => "Id required to do this action."]);
} else {
$user = Carrier::all(['id' => $id]);
if (count($user) > 0) {
if ($user[0]->delete()) {
echo json_encode(['result' => 1]);
}
} else {
echo json_encode(['result' => "Invalid id to delete this item."]);
}
}
} else {
echo json_encode(['result' => "Invalid action."]);
}
}