Browse Source

feat:add new files

igb 4 months ago
parent
commit
a5b8327a00
1 changed files with 4 additions and 8 deletions
  1. 4 8
      app/Http/Controllers/CollectionController.php

+ 4 - 8
app/Http/Controllers/CollectionController.php

@@ -31,14 +31,10 @@ class CollectionController extends Controller
     public function detail($slug)
     {
 
-
-        // 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();
-        }
+        // Find the tag by either slug or id
+        $tag = SitePageTag::where('slug', $slug)
+            ->orWhere('id', $slug)
+            ->first();
 
 
         if (!$tag) {