material_id) { $query->where('material_id', $materialId); } if ($warehouseId = $request->warehouse_id) { $query->where('warehouse_id', $warehouseId); } if ($projectId = $request->project_id) { $query->where('project_id', $projectId); } if ($type = $request->movement_type) { $query->where('movement_type', $type); } if ($from = $request->date_from) { $query->where('created_at', '>=', $from); } if ($to = $request->date_to) { $query->where('created_at', '<=', $to . ' 23:59:59'); } $movements = $query->latest()->paginate(20)->withQueryString(); $warehouses = Warehouse::select('id', 'ulid', 'name', 'code')->active()->get(); $projects = Project::select('id', 'ulid', 'name', 'code')->latest()->get(); return Inertia::render('MaterialLogistics::Inventory/Movements', [ 'movements' => $movements, 'warehouses' => $warehouses, 'projects' => $projects, 'filters' => $request->only(['material_id', 'warehouse_id', 'project_id', 'movement_type', 'date_from', 'date_to']), ]); } }