id()) ->orderBy('created_at', 'desc'); $start_date = now()->startOfMonth(); $end_date = now()->endOfMonth(); if ($request->startDate != '' && $request->endDate != '') { $start_date = Carbon::parse($request->startDate); $end_date = Carbon::parse($request->endDate); } $query->whereBetween('created_at', [$start_date, $end_date]); return inertia('Trx/Index', [ 'query' => $query->paginate(20), '_start_date' => $start_date->format('m/d/Y'), '_end_date' => $end_date->format('m/d/Y'), ]); } public function show(Sale $sale) { return inertia('Trx/Detail', [ 'sale' => $sale->load(['items.voucher.locationProfile.location']), ]); } }