本文整理汇总了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'));
}
}
}