Not able to fetch data from multiple categories
deekshithmasthmysore opened this issue · comments
I am using below query to fetch catgroy details and posts associated with that category,
// clean and simple all posts from a category
$cat = Category::slug('uncategorized')->posts->first();
but here I want to add get data from multiple categories like below,
['category1','category2'];
Please let me know how to fetch data from multiple categories
Right now my code looks like below,
$cat = Taxonomy::slug('category1')->first();
return $catposts = $cat->posts()
->where('post_status', 'publish')
->whereYear('post_date','2019')
->whereMonth('post_date', '10')
->newest()
->get();
Here I want to add another category "category2" to fetch the data.
Also I want to remove meta from the response as right now I am not using meta how to make it optional? if I want to make use of meta in post data I will enable if not remove meta data from post detail response.