legacy = $legacy; } public function photos(Request $request, $id = null) { $id = (int) ($id ?: 545); $result = $this->legacy->categoryPage('', null, $id); if (! $result) { return redirect('/'); } // categoryPage returns an array with keys used by legacy.browse $page_title = $result['page_title'] ?? ($result['category']->category_name ?? 'Members Photos'); $artworks = $result['artworks'] ?? collect(); // Ensure artworks include `slug`, `thumb`, and `thumb_srcset` properties expected by the legacy view if ($artworks && method_exists($artworks, 'getCollection')) { $artworks->getCollection()->transform(function ($row) { $row->slug = $row->slug ?? Str::slug($row->name ?? ''); $row->thumb = $row->thumb ?? ($row->thumb_url ?? null); $row->thumb_srcset = $row->thumb_srcset ?? ($row->thumb_srcset ?? null); return $row; }); } elseif (is_iterable($artworks)) { $artworks = collect($artworks)->map(function ($row) { $row->slug = $row->slug ?? Str::slug($row->name ?? ''); $row->thumb = $row->thumb ?? ($row->thumb_url ?? null); $row->thumb_srcset = $row->thumb_srcset ?? ($row->thumb_srcset ?? null); return $row; }); } return view('legacy::browse', compact('page_title', 'artworks')); } }