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.

30 lines
969 B

5 years ago
<?php
namespace App\Http\Controllers\Admin;
use App\Models\OrderItems;
class HomeController extends CommonController
{
public $bladePath = "admin";
public function index()
{
$month = date("Y-m");
$order_items = OrderItems::whereHas("order")->whereRaw("DATE_FORMAT(`service_date`,'%Y-%m') = '{$month}'")
->where("total", ">", 0)->get();
$order_items_count = $order_items->count();
$total = $order_items->sum("total");
$orders_count = $order_items->groupBy("order_id")->count();
foreach ($order_items as &$item) {
$item = $item->calculateFee();
}
$total_paramedic = $order_items->sum("paramedic_total");
$fee = $total - $total_paramedic;
$laravel_duration = microtime(true) - LARAVEL_START;
return view($this->bladePath . ".home", compact("orders_count", "order_items_count", "total", "total_paramedic", "fee", "laravel_duration"));
}
}