本文整理汇总了PHP中app\Order::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::destroy方法的具体用法?PHP Order::destroy怎么用?PHP Order::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy(Request $request, $id)
{
empty($id) && !empty($request->input('id')) && ($id = $request->input('id'));
$id = (array) $id;
foreach ($id as $v) {
$order = Order::destroy($v);
}
return $this->success('', count($id) > 5, compact('id'));
}
示例2: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id)
{
Order::destroy($id);
Session::flash('flash_message', 'Order deleted!');
return redirect('admin/orders');
}
示例3: orderDelete
function orderDelete($order_id)
{
if (\App\Order::findOrFail($order_id)) {
\App\Order::destroy($order_id);
\App\Item::where('order_id', $order_id)->delete();
return redirect("users/orders")->with('warning', 'Order deleted successfully!');
} else {
return redirect("users/orders")->with('error', 'Unable to find the order. Please try again.');
}
}
示例4: deleteOrder
public function deleteOrder($id)
{
Order::destroy($id);
}
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy(Request $request)
{
$rp_arr = [];
$user = \Auth::user();
if ($user->role->name != ('admin' or 'root')) {
// Permission denied
} else {
$data = $request->json()->get('data');
$lookUpArr = [];
for ($i = 0; $i < count($data); $i++) {
/*$from = Carbon::parse($data[$i]['from']);
$to = Carbon::parse($data[$i]['to']);
$location_id = \App\Location::where('name', $data[$i]['location'])->first()['id'];
\App\Order::where('from', $from)->where('to', $to)->where('location_id', $location_id)->delete();*/
$id = $data[$i]['id'];
$order = \App\Order::findOrFail($id);
array_push($lookUpArr, ['from' => $order->from, 'to' => $order->to, 'location_id' => $order->location_id]);
\App\Order::destroy($id);
}
$lookUpArr = array_unique($lookUpArr, SORT_REGULAR);
foreach ($lookUpArr as $value) {
$from = Carbon::parse($value['from']);
$to = Carbon::parse($value['to']);
$location_id = $value['location_id'];
$num_of_ordered = \App\Order::where('from', $from)->where('to', $to)->where('location_id', $location_id)->count();
$allowance = \App\Location::findOrFail($location_id)->capacity;
if ($num_of_ordered < $allowance) {
if ($num_of_ordered == 0) {
array_push($rp_arr, ['from' => $value['from'], 'to' => $value['to'], 'status' => '-1']);
} else {
array_push($rp_arr, ['from' => $value['from'], 'to' => $value['to'], 'status' => '1']);
}
} else {
array_push($rp_arr, ['from' => $value['from'], 'to' => $value['to'], 'status' => '0']);
}
}
}
return response()->json(['data' => $rp_arr]);
}
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
Order::destroy($id);
return redirect()->route('orders');
}