jeudi 27 juin 2019

Searching in cache data gives array first index 1

$this->getCachedCategories();
//Above code Stores the data in cache for future use. So, it goes to the database only 
//one time and next time pick the data from cache. So far everything is good.

//I have a search criteria which is in the form of array. I filter above cache data based 
//upon the search criteria and gets the data.
foreach ($userInputsForFilter as $key => $value) {
    $this->Categories = $this->Categories->where($key, $value);
}

Here is the screenshot. If you notice the data retrieved has first index from 1 instead of 0. Actually the second record came up after cache data was filtered.

enter image description here

Can you please tell why this happens when searching the cache data? This not happening when going to the database.

Array to JSON Code

$CategoryResponse = $this->iCategory->All([], []);
return \Response::json($CategoryResponse, 200);



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2RGqLd8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire