本文整理汇总了PHP中app\models\Order::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::findOrFail方法的具体用法?PHP Order::findOrFail怎么用?PHP Order::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Order
的用法示例。
在下文中一共展示了Order::findOrFail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
#find user
$order = Order::findOrFail($id);
#skin to call
$view = 'skins.skin_b.order.show';
#call the view with the user
return view($view, ['order' => $order]);
}
示例2: orderPosted
public function orderPosted(Request $request)
{
$order_id = $request->input('order_id');
$post_no = $request->input('post_no');
$order = Order::findOrFail($order_id);
if ($order->order_status_id != 2) {
return response()->json(['success' => false]);
}
$order->update(['post_no' => $post_no, 'order_status_id' => 3]);
return response()->json(['success' => true]);
}
示例3: store
public function store(Request $request, $order_id)
{
$order = Order::findOrFail($order_id);
if (!$order->canEdit()) {
throw new \Exception('not_editable');
}
$sku = $request->json()->get('sku');
$quantity = $request->json()->get('quantity');
$stock = ProductStock::with('product')->where('sku', '=', $sku)->firstOrFail();
$order_product = $stock->pick($quantity);
$new_product = response()->created($order->products()->save($order_product));
$order->calc($order->products()->get());
$order->save();
return $new_product;
}
示例4: show
public function show($id)
{
$data = ['order' => Order::findOrFail($id), 'products' => Product::lists('name', 'id')];
return view('order.edit', $data);
}
示例5: complete
public function complete(Request $request, $id)
{
$order = Order::findOrFail($id);
\DB::transaction(function () use($id, $request, $order) {
$order->complete()->logs()->save(new OrderLog(['do' => 'complete', 'name' => $request->user->name, 'comment' => $request->json()->get('comment', '')]));
});
return response()->updated($order);
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
$order = Order::findOrFail($id);
return view('frontoffice.orders.show', compact('order'));
}