[viewBag] == param("year"); $prodId = $this->prodId; $currentDate = Carbon\Carbon::now()->timezone('UTC +05:00'); if($year){ $this["amount"] = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId) ->whereMonth('created_at', $this["month"]) ->whereYear('created_at', $year) ->where('deleted_at', null) ->avg('amount'); }else{ $this["amount"] = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId) ->whereMonth('created_at', $this["month"]) ->whereYear('created_at', $currentDate->year) ->where('deleted_at', null) ->avg('amount'); } } ?> ==