input('target', false); // Validate inputs if (!$type) { return response()->json(false); } if (!$hash || is_numeric($hash)) { return response()->json(false); } $photoUrls = null; switch ($type) { // case 'ProductMarket': // // Assuming you have a helper function RequestPhotos($hash, $type) // $result = RequestPhotos($hash, $type); // return response()->json($result); case 'User': $photoUrls = User::where('hashkey', $hash) ->value('photourl') ?? false; break; case 'StoreMarket': $photoUrls = Store::where('hashkey', $hash)->value('photourl') ?? false; break; case 'ProductMarket': $photoUrls = Product::where('hashkey', $hash)->value('photourl') ?? false; break; default: return response()->json(false); } if (!$photoUrls) { return response()->json(false); } // $decoded = tryjsondecode($photoUrls); return response()->json($photoUrls); } }