|
@@ -32,8 +32,14 @@ class CollectionController extends Controller
|
|
|
{
|
|
|
|
|
|
|
|
|
- // 查找对应的 tag
|
|
|
- $tag = SitePageTag::where('slug', $slug)->first();
|
|
|
+ // Check if the $slug is numeric (ID), if so, fetch by ID
|
|
|
+ if (is_numeric($slug)) {
|
|
|
+ $tag = SitePageTag::find($slug); // Find by ID
|
|
|
+ } else {
|
|
|
+ // Otherwise, find by slug
|
|
|
+ $tag = SitePageTag::where('slug', $slug)->first();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if (!$tag) {
|
|
|
return response()->json(['message' => '标签未找到'], 404);
|