B
B
BonBon Slick2016-11-16 23:20:09
Laravel
BonBon Slick, 2016-11-16 23:20:09

Display only category name retrieved by $categories->where('category_id', $product->category_id)?

In the controller, I get all the categories, and pass the array to the view, where I actually have fields, each field has a category.
So I get for each field, its category

$categories->where('category_id', $product->category_id);

How to display only the category name?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2016-11-17
@BonBonSlick

{{$categories->find($product->category_id)->name}}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question