php - laravel 5.4 use where in blade template -


what correct syntax write code in laravel 5.4

@foreach($productchuck $product $product->category_id = 1) 

//some date section @endforeach

all want display product has category_id of 1

thanks in advance

the correct syntax be:

@foreach($productchuck->where('category_id', 1) $product)     .... @endforeach 

assuming $productchuck collection. see this more information.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -