本文整理匯總了PHP中OrderItem::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderItem::find方法的具體用法?PHP OrderItem::find怎麽用?PHP OrderItem::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OrderItem
的用法示例。
在下文中一共展示了OrderItem::find方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: viewOrder
public function viewOrder($id)
{
if (empty($id)) {
return Redirect::to('/');
}
$orderItem = OrderItem::find($id);
if (isset($orderItem)) {
$order = Order::where('id', $orderItem->order_id)->get();
if (isset($orderItem) && count($orderItem) > 0) {
return View::make('order.viewOrder')->with('found', true)->with('order', $order)->with('orderItem', $orderItem);
} else {
return View::make('order.viewOrder')->with('found', false);
}
} else {
return Redirect::to('/');
}
}
示例2: updateCourier
public function updateCourier()
{
$ids = Input::get('ids');
$docket = Input::get('docket');
$courier = Input::get('courier');
if (isset($ids) && isset($docket) && isset($courier)) {
$orderId = Session::get('order_id');
if (isset($orderId)) {
$order = Order::find($orderId);
if (isset($order)) {
$arIds = explode(',', $ids);
if (isset($arIds) && count($arIds) > 0) {
$orderDispatch = new OrderDispatch();
$orderDispatch->order_id = $orderId;
$orderDispatch->docket = $docket;
$orderDispatch->courier_id = $courier;
$orderDispatch->status = 'active';
$orderDispatch->save();
foreach ($arIds as $id) {
$orderItem = OrderItem::find($id);
if (isset($orderItem)) {
$orderDispatchItem = new OrderDispatchItem();
$orderDispatchItem->order_item_id = $id;
$orderDispatchItem->order_dispatch_id = $orderDispatch->id;
$orderDispatchItem->status = 'active';
$orderDispatchItem->save();
$orderItem->status = 'shipped';
$orderItem->save();
} else {
return json_encode(array('message' => 'done'));
}
}
return json_encode(array('message' => 'done'));
} else {
return json_encode(array('message' => 'done'));
}
} else {
return json_encode(array('message' => 'invalid'));
}
} else {
return json_encode(array('message' => 'invalid'));
}
}
}