本文整理汇总了PHP中Order::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::with方法的具体用法?PHP Order::with怎么用?PHP Order::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrder
/**
* Displays a single order.
*/
public function getOrder($id)
{
// Get the order.
$order = Order::with('order_lines.product', 'user', 'address')->first();
// Render the view.
return View::make('admin.order', ['order' => $order]);
}
示例2: index
public function index()
{
if (Auth::user()->check()) {
$query = Order::with(["user", "orderDetails", "orderDetails.image"]);
$query->where("user_id", Auth::user()->get()->id);
return $query->get();
}
return Redirect::route('account-sign-in');
}
示例3: indexAction
public function indexAction()
{
$query = Order::with(["account", "orderItems", "orderItems.product", "orderItems.product.category"]);
$account = Input::get("account");
if ($account) {
$query->where("account_id", $account);
}
return $query->get();
}
示例4: remembLog
public function remembLog()
{
if (!Session::has('username')) {
return Redirect::to('/');
} else {
$empId = DB::table('tblLogin')->join('tblEmployees', function ($join) {
$join->on('tblLogin.strLoginEmpID', '=', 'tblEmployees.strEmpID');
// ->where('tblLogin.strUsername','=',Session::get('username'));
})->get();
$orders = Order::with('supplier', 'employee', 'products', 'notes')->get();
$index = DB::table('tblInventory')->join('tblProducts', function ($join) {
$join->on('tblInventory.strProdID', '=', 'tblProducts.strProdID')->where('tblInventory.intAvailQty', '<=', '10');
})->get();
return View::make('index')->with('index', $index)->with('empId', $empId)->with('orders', $orders);
}
}
示例5: get_index
function get_index()
{
$vars = array('isManager' => $this->can('manager'), 'can' => array(), 'user' => $this->user(false));
$query = Order::with('manager')->name('o');
Event::fire('order.list.query', array($query, $this, &$vars['can']));
$rows = S::keys($query->get(), '?->id');
if ($rows) {
foreach ($rows as &$order) {
$order->current = false;
}
$current = static::detectCurrentOrder();
$current and $rows[$current->id]->current = true;
Event::fire('order.list.populate', array(&$rows, $this, &$vars));
}
$vars['rows'] = func('to_array', $rows);
Event::fire('order.list.vars', array(&$vars, $this));
return $vars;
}
示例6: editOrder
public function editOrder($orderId)
{
try {
$order = Order::with('images')->findorFail($orderId);
} catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
return App::abort(404);
}
$order = $order->toArray();
$order['images'] = reset($order['images']);
$this->layout->title = 'Edit Order';
$this->layout->content = View::make('admin.orders-one')->with(['order' => $order]);
}
示例7: Session
<?php
require_once '../classes/session.php';
require_once '../classes/functions.php';
require __DIR__ . '/../vendor/autoload.php';
require '../config.php';
require '../classes/boot.php';
require_once '../classes/Item.php';
require_once '../classes/Restaurant.php';
require_once '../classes/User.php';
require_once '../classes/Order.php';
$session = new Session();
$session->forceLogin('../index.php');
$user = User::find($session->getUsername());
$orders = Order::with('restaurant')->where('userid', $user->id)->orderBy('id', 'desc')->get();
getTemplate(1, 'header', []);
?>
<body>
<?php
include './includes/nav.php';
?>
<div class="orderscontainer" ng-controller="PageController">
<div class="container">
<div class="row">
<div class="col s12 m12">
<h3>Orders</h3>
<ul class="collection">
<?php
foreach ($orders as $key => $value) {
?>
示例8: edit_get
public function edit_get($id)
{
$this->_data['data'] = Order::with("user", "menu")->where("order_id", $id)->first();
return View::make("admin.content.order.edit", $this->_data)->with("titlePage", "Edit Order")->with("titleTable", "Sửa yêu cầu tại nhà hàng");
}
示例9: _sendDeliveryStoredInfo
protected function _sendDeliveryStoredInfo($id)
{
$order = \Order::with('orderSchedule', 'orderStuff', 'user')->find($id);
$order['order_payment'] = GetLastInvoiceOrder($id);
$to = ['code' => $order['order_payment']['code'], 'email' => $order['user']['email'], 'name' => $order['user']['fullname']];
$data = ['order' => $order];
\Mail::send('emails.order-stored-by-driver', $data, function ($message) use($to) {
$message->to($to['email'], $to['name'])->subject('[ThankSpace] Order #' . $to['code'] . ' sudah kami tangani');
});
}
示例10: order
public function order()
{
$orders = Order::with('supplier', 'employee', 'products', 'notes')->get();
return View::make('order.order')->with('orders', $orders);
}
示例11: getStorageDetail
/**
* Get order detail
*
* @param integer $id
* @return \Illuminate\Database\Eloquent\Model
*/
public function getStorageDetail($id)
{
$data = \Order::with('orderSchedule', 'orderStuff')->find($id);
$data['order_payment'] = GetLastInvoiceOrder($id);
return $data;
}
示例12: getIndex
public function getIndex()
{
$member_id = Auth::user()->id;
$orders = Order::with('orderItems')->where('member_id', '=', $member_id)->get();
return View::make('order')->with('orders', $orders);
}
示例13: show
/**
* Display the specified product.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$orders = Order::with(["customer.orders.invoices", "customer.orders.orderItems", "customer.customerType", "invoices", "employee", "business", "orderItems", "orderItems.product.unit"])->whereId($id)->get();
foreach ($orders as $order) {
if ($order->customer->customerType->customer_type == "Chủ cửa hàng") {
if ($order->business->type == "Nhập") {
$orderTotal = 0;
foreach ($order->orderItems as $product) {
$raw = $product->price * $product->quantity;
$discountValue = $raw * $product->discount / 100;
$taxValue = $raw * $product->tax / 100;
$total = $raw + $taxValue - $discountValue;
array_add($product, 'total', $total);
$orderTotal += $total;
}
array_add($order, 'order_total', $orderTotal);
}
if ($order->business->type == "Xuất") {
$orderTotal = 0;
foreach ($order->orderItems as $product) {
$raw = $product->price * $product->quantity;
$discountValue = $raw * $product->discount / 100;
$taxValue = $raw * $product->tax / 100;
$total = $raw + $taxValue - $discountValue;
array_add($product, 'total', $total);
$orderTotal += $total;
}
array_add($order, 'order_total', $orderTotal);
}
if ($order->business->name == "Thu góp vốn") {
$orderTotal = $order->price;
array_add($order, 'order_total', $orderTotal);
}
if ($order->business->type == "Thu" || $order->business->type == "Chi") {
$orderTotal = $order->price;
array_add($order, 'order_total', $orderTotal);
}
$paid = 0;
foreach ($order->invoices as $invoice) {
if ($order->business->type == "Xuất") {
if ($invoice->business->type == "Thu") {
$paid += $invoice->price;
}
}
if ($invoice->business->type == "Chi") {
$paid += $invoice->price;
}
}
array_add($order, 'paid', $paid);
}
if ($order->customer->customerType->customer_type == "Nhà cung cấp") {
if ($order->business->type == "Nhập") {
$orderTotal = 0;
foreach ($order->orderItems as $product) {
$raw = $product->price * $product->quantity;
$discountValue = $raw * $product->discount / 100;
$taxValue = $raw * $product->tax / 100;
$total = $raw + $taxValue - $discountValue;
array_add($product, 'total', $total);
$orderTotal += $total;
}
array_add($order, 'order_total', $orderTotal);
}
if ($order->business->type == "Xuất") {
$orderTotal = 0;
foreach ($order->orderItems as $product) {
$raw = $product->price * $product->quantity;
$discountValue = $raw * $product->discount / 100;
$taxValue = $raw * $product->tax / 100;
$total = $raw + $taxValue - $discountValue;
array_add($product, 'total', $total);
$orderTotal += $total;
}
array_add($order, 'order_total', $orderTotal);
}
if ($order->business->type == "Thu" || $order->business->type == "Chi") {
$orderTotal = $order->price;
array_add($order, 'order_total', $orderTotal);
}
$paid = 0;
foreach ($order->invoices as $invoice) {
if ($order->business->type == "Xuất") {
if ($invoice->business->type == "Thu") {
$paid += $invoice->price;
}
}
if ($invoice->business->type == "Chi") {
$paid += $invoice->price;
}
}
array_add($order, 'paid', $paid);
}
if ($order->customer->customerType->customer_type == "Khách mua lẻ") {
$oldDebt = 0;
//.........这里部分代码省略.........
示例14: payment
public function payment()
{
$orderId = Session::get('order_id');
if (isset($orderId)) {
$order = Order::with('orderItems')->find($orderId);
if (isset($order)) {
$product_array = array();
foreach ($order->orderItems as $orderItem) {
$product = Product::find($orderItem->product_id);
if (isset($product)) {
$product_array[] = array("name" => $product->name, "value" => $product->discounted_price, "description" => "");
}
}
$transactionId = microtime(true);
Session::put('transactionId', $transactionId);
$order->transaction_id = $transactionId;
$order->save();
return View::make('checkout.payment')->with('order', $order)->with('product_json', json_encode($product_array))->with('transactionId', $transactionId);
} else {
return Redirect::to('/');
}
} else {
return Redirect::to('/');
}
}
示例15: listOrders
public function listOrders($status, $page)
{
$adminId = Session::get('admin_id');
if (!isset($adminId)) {
return json_encode(array('message' => 'not logged'));
}
if (isset($status)) {
$orders = Order::with('user')->where('status', '=', $status)->get();
if (isset($orders) && count($orders) > 0) {
return json_encode(array('message' => 'found', 'orders' => $orders->toArray()));
} else {
return json_encode(array('message' => 'empty'));
}
} else {
return json_encode(array('message' => 'invalid'));
}
}