本文整理汇总了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 {