本文整理匯總了PHP中Orders::make方法的典型用法代碼示例。如果您正苦於以下問題:PHP Orders::make方法的具體用法?PHP Orders::make怎麽用?PHP Orders::make使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orders
的用法示例。
在下文中一共展示了Orders::make方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array_shift
if ($ele == "orders" && (empty($uri) || empty($uri[0]))) {
$orders = Orders::find_all();
$response['data'] = $orders;
} else {
$ele = array_shift($uri);
if ($ele == "customer" && ctype_digit($uri[0])) {
$customer_id = $uri[0];
$response['data'] = Orders::find_by_customer_id($customer_id);
$response['count'] = Orders::count_by_customer_id($customer_id);
}
}
}
} elseif ($method == "POST") {
$ele = array_shift($uri);
if (empty($uri) || empty($uri[0])) {
$order = Orders::make($_POST['customer_id'], $_POST['product_id']);
$order->save();
$response['data'] = "Saved";
}
} elseif ($method == "PUT") {
} elseif ($method == "DELETE") {
$ele = array_shift($uri);
if ($ele == "orders" && !empty($uri[0])) {
if (ctype_digit($uri[0])) {
$id = $uri[0];
$order = Orders::find_by_id($id);
if (!empty($order)) {
$order->delete();
$response['data'] = "Successfully Deleted!";
unset($order);
} else {