当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::leftJoin方法代码示例

本文整理汇总了PHP中app\Customer::leftJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::leftJoin方法的具体用法?PHP Customer::leftJoin怎么用?PHP Customer::leftJoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Customer的用法示例。


在下文中一共展示了Customer::leftJoin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     if (Gate::denies('customer.read')) {
         return view(config('app.template') . '.error.403');
     }
     $type = $request->get('type') ? $request->get('type') : 'registered';
     if ($type == 'registered') {
         $customers = Customer::leftJoin(DB::raw("\n                            (SELECT orders.`id`, orders.`customer_id`, SUM(order_details.`harga_jual` * (order_details.`qty` - ifnull(order_detail_returns.qty, 0)))\n                            AS total_penjualan FROM orders INNER JOIN order_details ON orders.`id` = order_details.`order_id`\n                            LEFT JOIN order_detail_returns on order_details.id = order_detail_returns.order_detail_id\n                            WHERE orders.`state` = 'Closed' GROUP BY orders.`id`)AS temp_orders\n                        "), 'customers.id', '=', 'temp_orders.customer_id')->whereNotNull('customers.nama')->select(['customers.*', DB::raw('count(temp_orders.id) as jumlah_kunjungan'), DB::raw('sum(temp_orders.total_penjualan)as total')])->groupBy('customers.id')->paginate(2);
         $data = ['customers' => $customers];
         return view(config('app.template') . '.customer.table', $data);
     } elseif ($type == 'unregistered') {
         $customers = Customer::whereNull('nama')->get();
         $data = ['customers' => $customers];
         return view(config('app.template') . '.customer.table-empty', $data);
     } else {
         abort(404);
     }
 }
开发者ID:sopoisun,项目名称:narotser-hadni-kodnop,代码行数:23,代码来源:CustomerController.php

示例2: table

 public function table()
 {
     $operations = ['<li>{!!link_to_route("customers.edit", "edit", ["customerId" => $id], ["class" => "glyphicon glyphicon-pencil"])!!}</li>', '<li>{!!link_to_route("customers.remove", "remove", ["customerId" => $id], ["class" => "glyphicon glyphicon-remove"])!!}</li>'];
     $customers = Customer::leftJoin('customer_group', 'customer.group_id', '=', 'customer_group.id')->select(['customer.id', 'customer.firstname', 'customer.lastname', 'customer.phone', 'customer_group.groupname']);
     return \Datatables::of($customers)->add_column('operations', '<ul class="operations">' . implode($operations) . '</ul>')->add_column('show', '{{route("customers.show", ["customerId" => $id])}}')->remove_column('id')->make(true);
 }
开发者ID:bengitiger,项目名称:cleverup-crm-laravel5,代码行数:6,代码来源:CustomerController.php

示例3: customerInfo

 public function customerInfo(Request $request)
 {
     $customer = Customer::leftJoin('users', 'users.userable_id', '=', 'customer.id')->select('customer.id', 'username', 'email', 'banned', 'name', 'address', 'phone')->findOrFail($request->id);
     return $customer;
 }
开发者ID:phucanhhoang,项目名称:IT4895,代码行数:5,代码来源:CustomerController.php


注:本文中的app\Customer::leftJoin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。