title = "Machine production by mechanic" url = "/machine-production-mechanic/:month" layout = "platform_main" is_hidden = 0 == param("month"); $year = $this->param("year"); if($this["month"] == 'default'){ $this["month"] = $currentDate->month; } if($year){ $this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->groupBy("mechanic_id")->get(); $this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"]) ->whereYear('created_at', $year) ->sum('produced_weight'); }else{ $this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->groupBy("mechanic_id")->addSelect(DB::raw("*, SUM(produced_weight) as produced_weight"))->get(); $this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"]) ->whereYear('created_at', $currentDate->year) ->sum('produced_weight'); } } ?> == {% put styles %} {% endput %}