You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

5 years ago
<?php
/**
* Created by PhpStorm.
* User: weizongsong
* Date: 2019-04-12
* Time: 22:34
*/
namespace App\Http\Controllers\Admin;
use App\Models\Orders;
use Illuminate\Http\Request;
class OrdersController extends CommonController
{
public $bladePath = "admin.orders";
public $urlPrefix = "admin/orders";
public $modelName = "订单";
public $modelClass = Orders::class;
public function index(Request $request)
{
$data = $this->model
->with([
"orderItems",
"firstItem",
"lastItem",
"project",
"product",
"customer",
"manager",
"bed" => function($query) {
$query->with(["room","building"]);
}
])
->orderBy("id", "desc")
->paginate(10);
foreach ($data as $order) {
$order = $order->refreshTotal();
}
return view($this->bladePath . ".index", compact("data"));
}
}