本文整理汇总了PHP中app\Order::join方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::join方法的具体用法?PHP Order::join怎么用?PHP Order::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::join方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search(Request $request)
{
$key_word = $request->key;
$orders = Order::join('customer', 'customer.id', '=', 'order.customer_id')->select('order.id', 'name', 'phone', 'address', 'ship_time', 'note', 'shipped', 'seen', 'order.created_at')->where('order.deleted', '=', 0)->where(function ($query) use($key_word) {
$query->where('name', 'like', '%' . $key_word . '%')->orWhere('phone', 'like', $key_word);
})->orderBy('created_at', 'desc')->get();
return $orders;
}
示例2: dealing
public function dealing(Request $request, $id)
{
$order = Order::join('order_expresses', 'order_expresses.id', '=', 'orders.id', 'INNER')->where('order_expresses.sid', $this->store->getKey())->find($id);
if (empty($order)) {
return $this->failure_noexists();
}
if ($order->deal(true)) {
return $this->success('order.success_store_deal');
} else {
return $this->failure('order.failure_deal');
}
}
示例3: karyawanDetail
public function karyawanDetail(Request $request)
{
if (Gate::denies('report.pertanggal.karyawan.detail')) {
return view(config('app.template') . '.error.403');
}
if ($request->get('karyawan_id')) {
if ($request->get('tanggal') || $request->get('bulan') || $request->get('tahun')) {
$karyawan_id = $request->get('karyawan_id');
$orderProduks = Order::join('order_details', 'orders.id', '=', 'order_details.order_id')->leftJoin('order_detail_returns', 'order_details.id', '=', 'order_detail_returns.order_detail_id')->join('produks', 'order_details.produk_id', '=', 'produks.id')->where('orders.state', 'Closed')->where('orders.karyawan_id', $karyawan_id)->groupBy('order_details.produk_id')->select(['produks.nama', 'order_details.harga_jual', DB::raw('(order_details.qty - ifnull(order_detail_returns.qty, 0))qty'), DB::raw('SUM(order_details.harga_jual * (order_details.qty - ifnull(order_detail_returns.qty, 0)))total_penjualan')]);
if ($request->get('tanggal')) {
$tanggal = $request->get('tanggal');
if ($request->get('to_tanggal')) {
$to_tanggal = $request->get('to_tanggal');
$orderProduks = $orderProduks->whereBetween('orders.tanggal', [$tanggal, $to_tanggal])->get();
} else {
$orderProduks = $orderProduks->where('orders.tanggal', $tanggal)->get();
}
} elseif ($request->get('bulan')) {
$bulan = $request->get('bulan');
$orderProduks = $orderProduks->where(DB::raw('SUBSTRING(orders.tanggal, 1, 7)'), $bulan)->get();
} else {
$tahun = $request->get('tahun');
$orderProduks = $orderProduks->where(DB::raw('SUBSTRING(orders.tanggal, 1, 4)'), $tahun)->get();
}
$data = ['orderProduks' => $orderProduks, 'karyawan' => \App\Karyawan::find($karyawan_id)];
return view(config('app.template') . '.report.pertanggal-karyawan-detail', $data);
} else {
return view(config('app.template') . '.error.404');
}
} else {
return view(config('app.template') . '.error.404');
}
}
示例4: _reportPertahun
protected function _reportPertahun(Request $request)
{
$id = $request->get('karyawan_id');
$tahun = $request->get('tahun') ? $request->get('tahun') : date('Y');
$karyawan = Karyawan::find($id);
if (!$karyawan) {
abort(404);
}
$start = Carbon::createFromFormat('Y', $tahun)->startOfYear();
$end = Carbon::createFromFormat('Y', $tahun)->endOfYear();
$months = [];
while ($start->lte($end)) {
$months[] = $start->copy();
$start->addMonth();
}
$reports = \App\Order::join('order_details', 'orders.id', '=', 'order_details.order_id')->leftJoin('order_detail_returns', 'order_details.id', '=', 'order_detail_returns.order_detail_id')->where('orders.state', 'Closed')->where('orders..karyawan_id', $id)->where(DB::raw('SUBSTRING(orders.tanggal, 1, 4)'), $tahun)->select(['orders.tanggal', DB::raw('SUBSTRING(orders.tanggal, 1, 7) as bulan'), DB::raw('SUM(order_details.harga_jual * (order_details.qty - ifnull(order_detail_returns.qty, 0)))total_penjualan')])->groupBy(DB::raw('SUBSTRING(orders.tanggal, 1, 7)'))->get();
return ['tanggal' => Carbon::createFromFormat('Y', $tahun), 'karyawan' => $karyawan, 'months' => $months, 'reports' => $reports];
}